mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add stringification for nodes. (#2704)
This is used to make error messages more readable. It'll be particularly important as more complex types are added.
This commit is contained in:
@@ -12,4 +12,12 @@ CARBON_DEFINE_ENUM_CLASS_NAMES(SemanticsBuiltinKind) = {
|
||||
#include "toolchain/semantics/semantics_builtin_kind.def"
|
||||
};
|
||||
|
||||
auto SemanticsBuiltinKind::label() -> llvm::StringRef {
|
||||
static constexpr llvm::StringLiteral Labels[] = {
|
||||
#define CARBON_SEMANTICS_BUILTIN_KIND(Name, Type, Label) Label,
|
||||
#include "toolchain/semantics/semantics_builtin_kind.def"
|
||||
};
|
||||
return Labels[AsInt()];
|
||||
}
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
Reference in New Issue
Block a user