From: Argyrios Kyrtzidis Date: Tue, 29 Sep 2009 19:41:13 +0000 (+0000) Subject: Introduce Type::getTypeClassName() that returns the string associated with the TypeCl... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd01f17358dc8ef19338c0e2321138dd0a6160d9;p=clang 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 c3fe86ce34..952671915f 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -874,6 +874,8 @@ public: /// 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 bda06ace1b..c3eade2cb9 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -668,6 +668,15 @@ bool Type::isSpecifierType() const { } } +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!");