]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Add NodeId to UseTree base class
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 23 Aug 2023 11:49:24 +0000 (13:49 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:46 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* ast/rust-item.h (class UseTree): Add `node_id` member.

gcc/rust/ast/rust-item.h

index 2c0e45962cea42b3a2b3951ad98d14a38b382acb..3480d126bc031e5711cf094682d2e462e840a7ac 100644 (file)
@@ -940,6 +940,7 @@ protected:
 class UseTree
 {
   location_t locus;
+  NodeId node_id;
 
 public:
   enum Kind
@@ -975,6 +976,7 @@ public:
   virtual Kind get_kind () const = 0;
 
   location_t get_locus () const { return locus; }
+  NodeId get_node_id () const { return node_id; }
 
   virtual void accept_vis (ASTVisitor &vis) = 0;
 
@@ -982,7 +984,9 @@ protected:
   // Clone function implementation as pure virtual method
   virtual UseTree *clone_use_tree_impl () const = 0;
 
-  UseTree (location_t locus) : locus (locus) {}
+  UseTree (location_t locus)
+    : locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
+  {}
 };
 
 // Use tree with a glob (wildcard) operator
@@ -1182,7 +1186,7 @@ public:
 
   Kind get_kind () const override { return Rebind; }
 
-  SimplePath get_path () const
+  const SimplePath &get_path () const
   {
     rust_assert (has_path ());
     return path;