Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccrs: use tl::optional for macro transcribers #2464

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

dkm
Copy link
Member

@dkm dkm commented Jul 21, 2023

gcc/rust/ChangeLog:

* ast/rust-ast-fragment.cc (Fragment::create_empty): New.
* ast/rust-ast-fragment.h (MacroTranscriberFunc): New.
* ast/rust-macro.h (MacroRulesDefinition): Use MacroTranscriberFunc.
* expand/rust-macro-builtins.cc
(MacroBuiltin::builtin_transcribers): likewise.
(MacroBuiltin::assert_handler): Return optional.
(MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::compile_error_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
(MacroBuiltin::stringify_handler): Likewise.
(MacroBuiltin::sorry): Likewise.
* expand/rust-macro-builtins.h (builtin_transcribers): Use
MacroTranscriberFunc.
(assert_handler): Return optional.
(file_handler): Likewise.
(column_handler): Likewise.
(include_bytes_handler): Likewise.
(include_str_handler): Likewise.
(compile_error_handler): Likewise.
(concat_handler): Likewise.
(env_handler): Likewise.
(cfg_handler): Likewise.
(include_handler): Likewise.
(line_handler): Likewise.
(stringify_handler): Likewise.
(sorry): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc):
Adjust to transcribers returning optional.

Signed-off-by: Marc Poulhiès [email protected]

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! Thank you :D

gcc/rust/ast/rust-ast-fragment.h Outdated Show resolved Hide resolved
gcc/rust/expand/rust-macro-builtins.cc Outdated Show resolved Hide resolved
gcc/rust/expand/rust-macro-expand.cc Outdated Show resolved Hide resolved
@dkm dkm force-pushed the dkm/optional_builtin_macro branch 2 times, most recently from e3c857a to f765177 Compare July 27, 2023 21:00
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last nit but otherwise looks good to me! thank you!

gcc/rust/ast/rust-ast-fragment.h Outdated Show resolved Hide resolved
@dkm dkm force-pushed the dkm/optional_builtin_macro branch from f765177 to 699ead8 Compare July 28, 2023 20:05
refs #2421.

gcc/rust/ChangeLog:

	* ast/rust-ast-fragment.cc (Fragment::create_empty): New.
	* ast/rust-ast-fragment.h (MacroTranscriberFunc): New.
	* ast/rust-macro.h (MacroRulesDefinition): Use MacroTranscriberFunc.
	* expand/rust-macro-builtins.cc
	(MacroBuiltin::builtin_transcribers): likewise.
	(MacroBuiltin::assert_handler): Return optional.
	(MacroBuiltin::file_handler): Likewise.
	(MacroBuiltin::column_handler): Likewise.
	(MacroBuiltin::include_bytes_handler): Likewise.
	(MacroBuiltin::include_str_handler): Likewise.
	(MacroBuiltin::compile_error_handler): Likewise.
	(MacroBuiltin::concat_handler): Likewise.
	(MacroBuiltin::env_handler): Likewise.
	(MacroBuiltin::cfg_handler): Likewise.
	(MacroBuiltin::include_handler): Likewise.
	(MacroBuiltin::line_handler): Likewise.
	(MacroBuiltin::stringify_handler): Likewise.
	(MacroBuiltin::sorry): Likewise.
	* expand/rust-macro-builtins.h (builtin_transcribers): Use
	MacroTranscriberFunc.
	(assert_handler): Return optional.
	(file_handler): Likewise.
	(column_handler): Likewise.
	(include_bytes_handler): Likewise.
	(include_str_handler): Likewise.
	(compile_error_handler): Likewise.
	(concat_handler): Likewise.
	(env_handler): Likewise.
	(cfg_handler): Likewise.
	(include_handler): Likewise.
	(line_handler): Likewise.
	(stringify_handler): Likewise.
	(sorry): Likewise.
	* expand/rust-macro-expand.cc (MacroExpander::expand_invoc):
	Adjust to transcribers returning optional.

Signed-off-by: Marc Poulhiès <[email protected]>
@dkm dkm force-pushed the dkm/optional_builtin_macro branch from 699ead8 to 486ad42 Compare July 30, 2023 19:57
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philberty philberty added this pull request to the merge queue Jul 31, 2023
Merged via the queue into master with commit c55ca4e Jul 31, 2023
9 checks passed
@dkm dkm deleted the dkm/optional_builtin_macro branch July 31, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants