[gcc r14-7892] gccrs: nr2.0: Add macros 2.0 in Ribs in TopLevel visitor
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 18:05:00 GMT 2024
https://gcc.gnu.org/g:8ea51b5c81fd4ff602eff4ab0e526699b87dde8c
commit r14-7892-g8ea51b5c81fd4ff602eff4ab0e526699b87dde8c
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date: Wed Aug 2 12:53:20 2023 +0200
gccrs: nr2.0: Add macros 2.0 in Ribs in TopLevel visitor
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Declare
macros in the current rib if they are macros 2.0.
Diff:
---
gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index 2c0e0779acd..c28d9227003 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -86,7 +86,8 @@ TopLevel::visit (AST::MacroRulesDefinition ¯o)
{
// we do not insert macros in the current rib as that needs to be done in the
// textual scope of the Early pass. we only insert them in the root of the
- // crate if they are marked with #[macro_export]
+ // crate if they are marked with #[macro_export]. The execption to this is
+ // macros 2.0, which get resolved and inserted like regular items.
if (is_macro_export (macro))
{
@@ -103,6 +104,9 @@ TopLevel::visit (AST::MacroRulesDefinition ¯o)
macro.get_rule_name ().as_string ().c_str ());
}
}
+
+ if (macro.get_kind () == AST::MacroRulesDefinition::MacroKind::DeclMacro)
+ insert_or_error_out (macro.get_rule_name (), macro, Namespace::Macros);
}
void
More information about the Gcc-cvs
mailing list