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]>
---
 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 ff6cca5afce..0342800f272 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 1f30739a5ed..a58fef00d46 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;
 
-- 
2.50.1

Reply via email to