From: vibhatsu <[email protected]>

gcc/rust/ChangeLog:

        * ast/rust-macro.h: remove get_macro_node_id and propagate
        MacroInvocation's node id through get_node_id for consistency
        * util/rust-hir-map.cc (Mappings::insert_macro_invocation): replace
        all get_macro_node_id calls with get_node_id calls
        (Mappings::lookup_macro_invocation): likewise
        (Mappings::insert_bang_proc_macro_invocation): likewise
        (Mappings::lookup_bang_proc_macro_invocation): likewise

Signed-off-by: vibhatsu <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/16190935a716d37e244a24f54393f5469fd11544

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4423

 gcc/rust/ast/rust-macro.h     |  7 +------
 gcc/rust/util/rust-hir-map.cc | 12 ++++++------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index ff6cca5af..0342800f2 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -672,12 +672,7 @@ public:
     outer_attrs = std::move (new_attrs);
   }
 
-  NodeId get_node_id () const override final
-  {
-    return ExprWithoutBlock::get_node_id ();
-  }
-
-  NodeId get_macro_node_id () const { return node_id; }
+  NodeId get_node_id () const override final { return node_id; }
 
   MacroInvocData &get_invoc_data () { return invoc_data; }
 
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index 1f30739a5..a58fef00d 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -915,16 +915,16 @@ void
 Mappings::insert_macro_invocation (AST::MacroInvocation &invoc,
                                   AST::MacroRulesDefinition *def)
 {
-  auto it = macroInvocations.find (invoc.get_macro_node_id ());
+  auto it = macroInvocations.find (invoc.get_node_id ());
   rust_assert (it == macroInvocations.end ());
 
-  macroInvocations[invoc.get_macro_node_id ()] = def;
+  macroInvocations[invoc.get_node_id ()] = def;
 }
 
 tl::optional<AST::MacroRulesDefinition *>
 Mappings::lookup_macro_invocation (AST::MacroInvocation &invoc)
 {
-  auto it = macroInvocations.find (invoc.get_macro_node_id ());
+  auto it = macroInvocations.find (invoc.get_node_id ());
   if (it == macroInvocations.end ())
     return tl::nullopt;
 
@@ -1084,16 +1084,16 @@ void
 Mappings::insert_bang_proc_macro_invocation (AST::MacroInvocation &invoc,
                                             BangProcMacro def)
 {
-  auto it = procmacroBangInvocations.find (invoc.get_macro_node_id ());
+  auto it = procmacroBangInvocations.find (invoc.get_node_id ());
   rust_assert (it == procmacroBangInvocations.end ());
 
-  procmacroBangInvocations[invoc.get_macro_node_id ()] = def;
+  procmacroBangInvocations[invoc.get_node_id ()] = def;
 }
 
 tl::optional<BangProcMacro &>
 Mappings::lookup_bang_proc_macro_invocation (AST::MacroInvocation &invoc)
 {
-  auto it = procmacroBangInvocations.find (invoc.get_macro_node_id ());
+  auto it = procmacroBangInvocations.find (invoc.get_node_id ());
   if (it == procmacroBangInvocations.end ())
     return tl::nullopt;
 

base-commit: c4e6d706e616a38b1a2adbcaf5b03a8255d14399
-- 
2.53.0

Reply via email to