Introduce Type::getTypeClassName() that returns the string associated with the TypeClass enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83090 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index c3fe86c..9526719 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -874,6 +874,8 @@
/// set of type specifiers.
bool isSpecifierType() const;
+ const char *getTypeClassName() const;
+
QualType getCanonicalTypeInternal() const { return CanonicalType; }
void dump() const;
virtual void getAsStringInternal(std::string &InnerString,
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index bda06ac..c3eade2 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -668,6 +668,15 @@
}
}
+const char *Type::getTypeClassName() const {
+ switch (TC) {
+ default: assert(0 && "Type class not in TypeNodes.def!");
+#define ABSTRACT_TYPE(Derived, Base)
+#define TYPE(Derived, Base) case Derived: return #Derived;
+#include "clang/AST/TypeNodes.def"
+ }
+}
+
const char *BuiltinType::getName(const LangOptions &LO) const {
switch (getKind()) {
default: assert(0 && "Unknown builtin type!");