diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-04-03 18:43:08 +0300 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-17 08:46:19 +0000 |
commit | 8129f20c818a5519491d7291a5e236bcb98845df (patch) | |
tree | 7c237ceda322933240a052102b9774f9f8681fc1 /gcc | |
parent | 8664ba4cf289bf7738fb4766d099ace571046171 (diff) | |
download | gcc-8129f20c818a5519491d7291a5e236bcb98845df.zip gcc-8129f20c818a5519491d7291a5e236bcb98845df.tar.gz gcc-8129f20c818a5519491d7291a5e236bcb98845df.tar.bz2 |
ast: Make AST::Kind an enum class
We're going to introduce AST::Kind::IDENTIFIER next, and with the
default C-style enum member scoping, this would cause name clashes.
Instead, convert AST::Kind into an enum class, so that its members
are properly namespaced.
gcc/rust/ChangeLog:
* ast/rust-ast.h (Kind): Convert into a C++ enum class
* expand/rust-macro-builtins.cc: Adapt to the change
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 2 | ||||
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 540a262..ee3c89a 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -39,7 +39,7 @@ class ASTVisitor; using AttrVec = std::vector<Attribute>; // The available kinds of AST Nodes -enum Kind +enum class Kind { UNKNOWN, MACRO_RULES_DEFINITION, diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc index fe401aa..ed670e3 100644 --- a/gcc/rust/expand/rust-macro-builtins.cc +++ b/gcc/rust/expand/rust-macro-builtins.cc @@ -612,7 +612,7 @@ MacroBuiltin::concat_handler (Location invoc_locus, AST::MacroInvocData &invoc) for (auto &expr : expanded_expr) { if (!expr->is_literal () - && expr->get_ast_kind () != AST::MACRO_INVOCATION) + && expr->get_ast_kind () != AST::Kind::MACRO_INVOCATION) { has_error = true; rust_error_at (expr->get_locus (), "expected a literal"); |