aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-04-03 18:43:08 +0300
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:34:08 +0100
commit635a63c032491f6da2c82d9fdac0b2c8c020d68e (patch)
tree973a77c8d1345a0825721ec3b5e8688cc42572f2 /gcc
parent197962cb062edb41538af9f5e9b4c02f090c4ba8 (diff)
downloadgcc-635a63c032491f6da2c82d9fdac0b2c8c020d68e.zip
gcc-635a63c032491f6da2c82d9fdac0b2c8c020d68e.tar.gz
gcc-635a63c032491f6da2c82d9fdac0b2c8c020d68e.tar.bz2
gccrs: 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.h2
-rw-r--r--gcc/rust/expand/rust-macro-builtins.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 7d7de89..3aed56a 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 6dce1aff7..9bee712 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");