mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Modify EnumBase to better support the namespacing of toolchain (#3156)
The different approach to Names avoids the issues with trying to define a static member (or also member function) of the templated instance of Carbon::Internal::EnumBase from a non-enclosing namespace such as Carbon::SemIR. Note, I'm trying to do this from the cpp file. An alternative might be to do `inline constexpr llvm::StringLiteral Names[]` in the .h file, but I think concerns had been raised about that needing deduplication.
This commit is contained in:
@@ -15,6 +15,5 @@ CARBON_DEFINE_ENUM_CLASS_NAMES(AstRttiNodeKind) = {
|
||||
CARBON_ENUM_NAME_FUNCTION(C##Kind) { \
|
||||
return AstRttiNodeKind(static_cast<const C##Kind&>(*this)).name(); \
|
||||
}
|
||||
CARBON_AST_FOR_EACH_ABSTRACT_CLASS(DEFINE_NAME_FUNCTION)
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
Reference in New Issue
Block a user