public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Make AST::Kind an enum class
@ 2023-04-18 16:45 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-18 16:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8129f20c818a5519491d7291a5e236bcb98845df
commit 8129f20c818a5519491d7291a5e236bcb98845df
Author: Sergey Bugaev <bugaevc@gmail.com>
Date: Mon Apr 3 18:43:08 2023 +0300
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>
Diff:
---
gcc/rust/ast/rust-ast.h | 2 +-
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 540a2624b3f..ee3c89a298d 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 fe401aa868e..ed670e3b26c 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");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-18 16:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 16:45 [gcc/devel/rust/master] ast: Make AST::Kind an enum class Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).