[gcc r14-7479] gccrs: ast: Add AST::Kind::IDENTIFIER

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:37:27 GMT 2024


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

commit r14-7479-gb503080cd219b8f05184f6322d943d1c03f56b08
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon Apr 3 18:48:45 2023 +0300

    gccrs: ast: Add AST::Kind::IDENTIFIER
    
    ...and return it from IdentifierExpr::get_ast_kind (). This enables
    other code to dynamically test whether an expression is in fact an
    IdentifierExpr.
    
    gcc/rust/ChangeLog:
            * ast/rust-ast.h: Add AST::Kind::IDENTIFIER
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>

Diff:
---
 gcc/rust/ast/rust-ast.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 3aed56aa7b6..921832ea501 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -44,6 +44,7 @@ enum class Kind
   UNKNOWN,
   MACRO_RULES_DEFINITION,
   MACRO_INVOCATION,
+  IDENTIFIER,
 };
 
 class Visitable
@@ -1072,6 +1073,8 @@ public:
     outer_attrs = std::move (new_attrs);
   }
 
+  Kind get_ast_kind () const override { return Kind::IDENTIFIER; }
+
 protected:
   // Clone method implementation
   IdentifierExpr *clone_expr_without_block_impl () const final override


More information about the Gcc-cvs mailing list