]> granicus.if.org Git - clang/commitdiff
Use getAs instead of cast/dyn_cast on types. (I'm sure Doug will appreciate this).
authorAnders Carlsson <andersca@mac.com>
Thu, 11 Feb 2010 19:45:15 +0000 (19:45 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 11 Feb 2010 19:45:15 +0000 (19:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95911 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVtable.cpp

index 703e0970e37014d2d5266e8e37e1ac224230c58f..70c9c6c8eeda3682e5684fcafcacd0f1249b948c 100644 (file)
@@ -75,12 +75,12 @@ TypeConversionRequiresAdjustment(ASTContext &Ctx,
     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 @@ TypeConversionRequiresAdjustment(ASTContext &Ctx,
   }
   
   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);
 }