public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Refactor naming of canonical path mappings
@ 2022-06-08 11:53 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 11:53 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ddeb2118011b84b763bbb29d9cca935005f31f18

commit ddeb2118011b84b763bbb29d9cca935005f31f18
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Mon Nov 22 17:08:16 2021 +0000

    Refactor naming of canonical path mappings
    
    These names are poor and are easily conflated with the singleton mappings
    which contain all mappings known in this compilation unit.

Diff:
---
 gcc/rust/resolve/rust-name-resolver.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h
index d5703ed5dfb..c73a4c0f448 100644
--- a/gcc/rust/resolve/rust-name-resolver.h
+++ b/gcc/rust/resolve/rust-name-resolver.h
@@ -42,8 +42,8 @@ public:
     const CanonicalPath &path, NodeId id, Location locus, bool shadow,
     std::function<void (const CanonicalPath &, NodeId, Location)> dup_cb)
   {
-    auto it = mappings.find (path);
-    bool already_exists = it != mappings.end ();
+    auto it = path_mappings.find (path);
+    bool already_exists = it != path_mappings.end ();
     if (already_exists && !shadow)
       {
 	for (auto &decl : decls_within_rib)
@@ -58,8 +58,8 @@ public:
 	return;
       }
 
-    mappings[path] = id;
-    reverse_mappings.insert (std::pair<NodeId, CanonicalPath> (id, path));
+    path_mappings[path] = id;
+    reverse_path_mappings.insert (std::pair<NodeId, CanonicalPath> (id, path));
     decls_within_rib.insert (std::pair<NodeId, Location> (id, locus));
     references[id] = {};
 
@@ -69,8 +69,8 @@ public:
 
   bool lookup_name (const CanonicalPath &ident, NodeId *id)
   {
-    auto it = mappings.find (ident);
-    if (it == mappings.end ())
+    auto it = path_mappings.find (ident);
+    if (it == path_mappings.end ())
       return false;
 
     *id = it->second;
@@ -79,8 +79,8 @@ public:
 
   bool lookup_canonical_path (const NodeId &id, CanonicalPath *ident)
   {
-    auto it = reverse_mappings.find (id);
-    if (it == reverse_mappings.end ())
+    auto it = reverse_path_mappings.find (id);
+    if (it == reverse_path_mappings.end ())
       return false;
 
     *ident = it->second;
@@ -89,8 +89,8 @@ public:
 
   void clear_name (const CanonicalPath &ident, NodeId id)
   {
-    mappings.erase (ident);
-    reverse_mappings.erase (id);
+    path_mappings.erase (ident);
+    reverse_path_mappings.erase (id);
 
     for (auto &it : decls_within_rib)
       {
@@ -154,8 +154,8 @@ public:
 private:
   CrateNum crate_num;
   NodeId node_id;
-  std::map<CanonicalPath, NodeId> mappings;
-  std::map<NodeId, CanonicalPath> reverse_mappings;
+  std::map<CanonicalPath, NodeId> path_mappings;
+  std::map<NodeId, CanonicalPath> reverse_path_mappings;
   std::set<std::pair<NodeId, Location>> decls_within_rib;
   std::map<NodeId, std::set<NodeId>> references;
 };


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

only message in thread, other threads:[~2022-06-08 11:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 11:53 [gcc/devel/rust/master] Refactor naming of canonical path mappings Thomas Schwinge

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).