]> granicus.if.org Git - clang/commitdiff
simplify these predicates a bit.
authorChris Lattner <sabre@nondot.org>
Sun, 11 Jan 2009 23:59:49 +0000 (23:59 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 11 Jan 2009 23:59:49 +0000 (23:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62061 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp

index 1d42b64bb12735fc957e47a3fa074b37190ac90e..b9db41e95ea81e63ecb4e66029d206fbc98df61f 100644 (file)
@@ -122,21 +122,18 @@ bool Type::isDerivedType() const {
 }
 
 bool Type::isClassType() const {
-  if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
-    if (RT->getDecl()->isClass())
-      return true;
+  if (const RecordType *RT = getAsRecordType())
+    return RT->getDecl()->isClass();
   return false;
 }
 bool Type::isStructureType() const {
-  if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
-    if (RT->getDecl()->isStruct())
-      return true;
+  if (const RecordType *RT = getAsRecordType())
+    return RT->getDecl()->isStruct();
   return false;
 }
 bool Type::isUnionType() const {
-  if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
-    if (RT->getDecl()->isUnion())
-      return true;
+  if (const RecordType *RT = getAsRecordType())
+    return RT->getDecl()->isUnion();
   return false;
 }