]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Make AST::Kind an enum class
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 3 Apr 2023 15:43:08 +0000 (18:43 +0300)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:08 +0000 (18:34 +0100)
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>
gcc/rust/ast/rust-ast.h
gcc/rust/expand/rust-macro-builtins.cc

index 7d7de89cc8be1533512780c6cb29067c05cab303..3aed56aa7b68a2633add6562c069208145bd3f97 100644 (file)
@@ -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,
index 6dce1aff73a063912b44fa6f323281ff896823df..9bee71286dbb48b9711a03043ee49d31a8c1dffb 100644 (file)
@@ -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");