[cfe-commits] r95911 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Thu Feb 11 11:45:15 PST 2010


Author: andersca
Date: Thu Feb 11 13:45:15 2010
New Revision: 95911

URL: http://llvm.org/viewvc/llvm-project?rev=95911&view=rev
Log:
Use getAs instead of cast/dyn_cast on types. (I'm sure Doug will appreciate this).

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=95911&r1=95910&r2=95911&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Feb 11 13:45:15 2010
@@ -75,12 +75,12 @@
     return false;
   }
   
-  if (const ReferenceType *RT = dyn_cast<ReferenceType>(CanDerivedType)) {
+  if (const ReferenceType *RT = CanDerivedType->getAs<ReferenceType>()) {
     CanDerivedType = RT->getPointeeType();
-    CanBaseType = cast<ReferenceType>(CanBaseType)->getPointeeType();
-  } else if (const PointerType *PT = dyn_cast<PointerType>(CanDerivedType)) {
+    CanBaseType = CanBaseType->getAs<ReferenceType>()->getPointeeType();
+  } else if (const PointerType *PT = CanDerivedType->getAs<PointerType>()) {
     CanDerivedType = PT->getPointeeType();
-    CanBaseType = cast<PointerType>(CanBaseType)->getPointeeType();
+    CanBaseType = CanBaseType->getAs<PointerType>()->getPointeeType();
   } else {
     assert(false && "Unexpected return type!");
   }
@@ -91,10 +91,10 @@
   }
   
   const CXXRecordDecl *DerivedDecl = 
-    cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
+    cast<CXXRecordDecl>(CanDerivedType->getAs<RecordType>()->getDecl());
   
   const CXXRecordDecl *BaseDecl = 
-    cast<CXXRecordDecl>(cast<RecordType>(CanBaseType)->getDecl());
+    cast<CXXRecordDecl>(CanBaseType->getAs<RecordType>()->getDecl());
   
   return TypeConversionRequiresAdjustment(Ctx, DerivedDecl, BaseDecl);
 }





More information about the cfe-commits mailing list