From: Peter Collingbourne Date: Thu, 26 Jan 2012 03:33:46 +0000 (+0000) Subject: Simplify {Record,Enum}Type::classof. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95b68f94d28a4b94f4c3fb029b9f1690e1bb728b;p=clang Simplify {Record,Enum}Type::classof. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149038 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index a026961b20..cb183b8d7a 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -3094,8 +3094,6 @@ public: return T->getTypeClass() >= TagFirst && T->getTypeClass() <= TagLast; } static bool classof(const TagType *) { return true; } - static bool classof(const RecordType *) { return true; } - static bool classof(const EnumType *) { return true; } }; /// RecordType - This is a helper class that allows the use of isa/cast/dyncast @@ -3121,10 +3119,7 @@ public: bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } - static bool classof(const TagType *T); - static bool classof(const Type *T) { - return isa(T) && classof(cast(T)); - } + static bool classof(const Type *T) { return T->getTypeClass() == Record; } static bool classof(const RecordType *) { return true; } }; @@ -3143,10 +3138,7 @@ public: bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } - static bool classof(const TagType *T); - static bool classof(const Type *T) { - return isa(T) && classof(cast(T)); - } + static bool classof(const Type *T) { return T->getTypeClass() == Enum; } static bool classof(const EnumType *) { return true; } }; diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index b6ce59e977..698474b838 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1802,14 +1802,6 @@ CXXRecordDecl *InjectedClassNameType::getDecl() const { return cast(getInterestingTagDecl(Decl)); } -bool RecordType::classof(const TagType *TT) { - return isa(TT->getDecl()); -} - -bool EnumType::classof(const TagType *TT) { - return isa(TT->getDecl()); -} - IdentifierInfo *TemplateTypeParmType::getIdentifier() const { return isCanonicalUnqualified() ? 0 : getDecl()->getIdentifier(); }