diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2025-02-21 19:07:59 -0500 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-02-23 19:54:11 +0000 |
commit | c3a707ae42bb15b84924d93ea99b040b190b21b1 (patch) | |
tree | 8168fcee2c5c6e5e84dd1bc06997ada16a0d9511 /gcc/rust/expand | |
parent | 5c675798ed7c6e753c44b9b7d5cfdc7ce8a4c2bb (diff) | |
download | gcc-c3a707ae42bb15b84924d93ea99b040b190b21b1.zip gcc-c3a707ae42bb15b84924d93ea99b040b190b21b1.tar.gz gcc-c3a707ae42bb15b84924d93ea99b040b190b21b1.tar.bz2 |
Fix expansion of macros inside modules
gcc/rust/ChangeLog:
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Override DefaultASTVisitor in order to
expand a module's items, rather than directly visit them.
* expand/rust-expand-visitor.h
(ExpandVisitor::visit): Add override.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-expand-module.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/expand')
-rw-r--r-- | gcc/rust/expand/rust-expand-visitor.cc | 6 | ||||
-rw-r--r-- | gcc/rust/expand/rust-expand-visitor.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/expand/rust-expand-visitor.cc b/gcc/rust/expand/rust-expand-visitor.cc index d1886ca..b3a53c1 100644 --- a/gcc/rust/expand/rust-expand-visitor.cc +++ b/gcc/rust/expand/rust-expand-visitor.cc @@ -722,6 +722,12 @@ ExpandVisitor::visit (AST::TypeBoundWhereClauseItem &item) } void +ExpandVisitor::visit (AST::Module &module) +{ + expand_inner_items (module.get_items ()); +} + +void ExpandVisitor::visit (AST::ExternCrate &crate) {} diff --git a/gcc/rust/expand/rust-expand-visitor.h b/gcc/rust/expand/rust-expand-visitor.h index c353689..131d62f 100644 --- a/gcc/rust/expand/rust-expand-visitor.h +++ b/gcc/rust/expand/rust-expand-visitor.h @@ -237,6 +237,7 @@ public: void visit (AST::TypeParam ¶m) override; void visit (AST::LifetimeWhereClauseItem &) override; void visit (AST::TypeBoundWhereClauseItem &item) override; + void visit (AST::Module &module) override; void visit (AST::ExternCrate &crate) override; void visit (AST::UseTreeGlob &) override; void visit (AST::UseTreeList &) override; |