diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-07-13 11:57:41 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:55:59 +0100 |
commit | 987a411d409fac53041033979e12c404a8995e93 (patch) | |
tree | 42f649ea9798cc92d0e57a81200c859527fff394 /gcc/rust/ast/rust-ast.h | |
parent | ed866110ef0f90f24c60a91a7141565b706ad185 (diff) | |
download | gcc-987a411d409fac53041033979e12c404a8995e93.zip gcc-987a411d409fac53041033979e12c404a8995e93.tar.gz gcc-987a411d409fac53041033979e12c404a8995e93.tar.bz2 |
gccrs: resolve: Convert identifier to a SimplePath
We wish to remove node ids from identifiers, because they do not make
that much sense and are only used for procedural macros anyway. This
means we either have to wrap those into a structure or converting them
to an existing structure that already have a node id. This commit
convert those meta word identifiers to a meta path SimplePath.
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add new constructor for SimplePath from an
identifier.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Add
conversion.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-ast.h')
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 5be6932..8ec707f 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -427,6 +427,13 @@ public: node_id (Analysis::Mappings::get ()->get_next_node_id ()) {} + SimplePath (Identifier ident) + : opening_scope_resolution (false), + segments ({SimplePathSegment (ident.as_string (), ident.get_locus ())}), + locus (ident.get_locus ()), + node_id (Analysis::Mappings::get ()->get_next_node_id ()) + {} + // Creates an empty SimplePath. static SimplePath create_empty () { |