mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 18:02:40 +00: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:
1 parent
e0c90767be
commit
c615d76196
12 files changed
+95
-27
No files matched your search
@@ -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