[cfe-commits] r62061 - /cfe/trunk/lib/AST/Type.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 15:59:49 PST 2009


Author: lattner
Date: Sun Jan 11 17:59:49 2009
New Revision: 62061

URL: http://llvm.org/viewvc/llvm-project?rev=62061&view=rev
Log:
simplify these predicates a bit.

Modified:
    cfe/trunk/lib/AST/Type.cpp

Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=62061&r1=62060&r2=62061&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Sun Jan 11 17:59:49 2009
@@ -122,21 +122,18 @@
 }
 
 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;
 }
 





More information about the cfe-commits mailing list