aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/Make-lang.in
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-03-20 04:17:04 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:28:38 +0100
commitd85089ea28c99eabbee89fd434bea748d1623427 (patch)
treea7f1831df6209fa97509abd8ac30309ce527e39d /gcc/rust/Make-lang.in
parenta7382ca757ed535e7bc74782038104ef5ac59694 (diff)
downloadgcc-d85089ea28c99eabbee89fd434bea748d1623427.zip
gcc-d85089ea28c99eabbee89fd434bea748d1623427.tar.gz
gcc-d85089ea28c99eabbee89fd434bea748d1623427.tar.bz2
gccrs: expand: Add new ExpandVisitor class
This class takes care of actually performing the macro expansion by calling into the MacroExpander for each node of a given AST, leaving the job of cfg-stripping nodes to the AttrVisitor. gcc/rust/ChangeLog: * Make-lang.in: Add new object file. * expand/rust-attribute-visitor.cc (AttrVisitor::go): Visit all items of a crate. (AttrVisitor::expand_struct_fields): Do not perform macro expansion anymore. (AttrVisitor::expand_function_params): Likewise. (AttrVisitor::expand_generic_args): Likewise. (AttrVisitor::expand_qualified_path_type): Likewise. (AttrVisitor::expand_self_param): Likewise. (AttrVisitor::expand_trait_function_decl): Likewise. (AttrVisitor::expand_trait_method_decl): Likewise. (AttrVisitor::visit): Likewise. (AttrVisitor::maybe_expand_expr): Remove function. (AttrVisitor::maybe_expand_type): Likewise. * expand/rust-attribute-visitor.h: Do not keep MacroExpander inside AttrVisitor anymore. * expand/rust-macro-expand.h (struct MacroExpander): Turn ContextType into an enum class for more type safety. * expand/rust-macro-expand.cc (MacroExpander::expand_crate): Use new ContextType API. * rust-session-manager.cc (Session::expansion): Call into ExpandVisitor. * expand/rust-expand-visitor.cc: New file. * expand/rust-expand-visitor.h: New file. gcc/testsuite/ChangeLog: * rust/compile/macro49.rs: New test. * rust/compile/macro50.rs: New test.
Diffstat (limited to 'gcc/rust/Make-lang.in')
-rw-r--r--gcc/rust/Make-lang.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in
index 8f48390..083a44e 100644
--- a/gcc/rust/Make-lang.in
+++ b/gcc/rust/Make-lang.in
@@ -82,6 +82,7 @@ GRS_OBJS = \
rust/rust-compile-resolve-path.o \
rust/rust-macro-expand.o \
rust/rust-attribute-visitor.o \
+ rust/rust-expand-visitor.o \
rust/rust-macro-invoc-lexer.o \
rust/rust-macro-substitute-ctx.o \
rust/rust-macro-builtins.o \