]> granicus.if.org Git - clang/commitdiff
Simplify {Record,Enum}Type::classof.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 26 Jan 2012 03:33:46 +0000 (03:33 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 26 Jan 2012 03:33:46 +0000 (03:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149038 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
lib/AST/Type.cpp

index a026961b20c492e97d75a5e9a35f8866bbabed8f..cb183b8d7ac6106b7f692eaac18f463dbd691710 100644 (file)
@@ -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<TagType>(T) && classof(cast<TagType>(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<TagType>(T) && classof(cast<TagType>(T));
-  }
+  static bool classof(const Type *T) { return T->getTypeClass() == Enum; }
   static bool classof(const EnumType *) { return true; }
 };
 
index b6ce59e977d97605e4d188bfb7ecfaf7216aff01..698474b8383b7ae7ca4082c8aa13fef5eba4e644 100644 (file)
@@ -1802,14 +1802,6 @@ CXXRecordDecl *InjectedClassNameType::getDecl() const {
   return cast<CXXRecordDecl>(getInterestingTagDecl(Decl));
 }
 
-bool RecordType::classof(const TagType *TT) {
-  return isa<RecordDecl>(TT->getDecl());
-}
-
-bool EnumType::classof(const TagType *TT) {
-  return isa<EnumDecl>(TT->getDecl());
-}
-
 IdentifierInfo *TemplateTypeParmType::getIdentifier() const {
   return isCanonicalUnqualified() ? 0 : getDecl()->getIdentifier();
 }