public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7997] gccrs: Change proc macro mapping definition insertion
@ 2024-01-16 18:12 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2504357146d5f9e5b9b87aa9cf79dd4f14e9fcd5

commit r14-7997-g2504357146d5f9e5b9b87aa9cf79dd4f14e9fcd5
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Aug 29 16:41:55 2023 +0200

    gccrs: Change proc macro mapping definition insertion
    
    Since the node id already is contained into the proc macro we may omit
    it from the function arguments.
    
    gcc/rust/ChangeLog:
    
            * util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def):
            Change the function body to fetch the node id from the macro
            parameter.
            (Mappings::insert_bang_proc_macro_def): Likewise.
            (Mappings::insert_attribute_proc_macro_def): Likewise.
            * util/rust-hir-map.h: Update the function's prototype by
            removing the node id from the list of arguments.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/util/rust-hir-map.cc | 18 +++++++++---------
 gcc/rust/util/rust-hir-map.h  |  6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index 67d589cc247..748b15b9afa 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -1003,30 +1003,30 @@ Mappings::lookup_attribute_proc_macros (CrateNum num)
 }
 
 void
-Mappings::insert_derive_proc_macro_def (NodeId id, CustomDeriveProcMacro macro)
+Mappings::insert_derive_proc_macro_def (CustomDeriveProcMacro macro)
 {
-  auto it = procmacroDeriveMappings.find (id);
+  auto it = procmacroDeriveMappings.find (macro.get_node_id ());
   rust_assert (it == procmacroDeriveMappings.end ());
 
-  procmacroDeriveMappings[id] = macro;
+  procmacroDeriveMappings[macro.get_node_id ()] = macro;
 }
 
 void
-Mappings::insert_bang_proc_macro_def (NodeId id, BangProcMacro macro)
+Mappings::insert_bang_proc_macro_def (BangProcMacro macro)
 {
-  auto it = procmacroBangMappings.find (id);
+  auto it = procmacroBangMappings.find (macro.get_node_id ());
   rust_assert (it == procmacroBangMappings.end ());
 
-  procmacroBangMappings[id] = macro;
+  procmacroBangMappings[macro.get_node_id ()] = macro;
 }
 
 void
-Mappings::insert_attribute_proc_macro_def (NodeId id, AttributeProcMacro macro)
+Mappings::insert_attribute_proc_macro_def (AttributeProcMacro macro)
 {
-  auto it = procmacroAttributeMappings.find (id);
+  auto it = procmacroAttributeMappings.find (macro.get_node_id ());
   rust_assert (it == procmacroAttributeMappings.end ());
 
-  procmacroAttributeMappings[id] = macro;
+  procmacroAttributeMappings[macro.get_node_id ()] = macro;
 }
 
 tl::optional<CustomDeriveProcMacro &>
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index 85da2802640..a663bfe4a56 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -302,9 +302,9 @@ public:
   tl::optional<std::vector<AttributeProcMacro> &>
   lookup_attribute_proc_macros (CrateNum num);
 
-  void insert_derive_proc_macro_def (NodeId id, CustomDeriveProcMacro macro);
-  void insert_bang_proc_macro_def (NodeId id, BangProcMacro macro);
-  void insert_attribute_proc_macro_def (NodeId id, AttributeProcMacro macro);
+  void insert_derive_proc_macro_def (CustomDeriveProcMacro macro);
+  void insert_bang_proc_macro_def (BangProcMacro macro);
+  void insert_attribute_proc_macro_def (AttributeProcMacro macro);
 
   tl::optional<CustomDeriveProcMacro &>
   lookup_derive_proc_macro_def (NodeId id);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:12 [gcc r14-7997] gccrs: Change proc macro mapping definition insertion Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).