aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-08-23 13:49:24 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 12:36:46 +0100
commit1133c1c671d91243b54dd5f6d2fed658ce1f8d9a (patch)
tree2a66addafaaf90138b2c77cc01a9996629aa9e01
parent0a5cc7a4cb2d379f17f75491fae8428dec901e1c (diff)
downloadgcc-1133c1c671d91243b54dd5f6d2fed658ce1f8d9a.zip
gcc-1133c1c671d91243b54dd5f6d2fed658ce1f8d9a.tar.gz
gcc-1133c1c671d91243b54dd5f6d2fed658ce1f8d9a.tar.bz2
gccrs: ast: Add NodeId to UseTree base class
gcc/rust/ChangeLog: * ast/rust-item.h (class UseTree): Add `node_id` member.
-rw-r--r--gcc/rust/ast/rust-item.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 2c0e459..3480d12 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -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;