@@ -505,7 +505,7 @@ namespace {
505
505
// / otherwise.
506
506
bool convertBlockPointerToFunctionPointer (QualType &T) {
507
507
if (isTopLevelBlockPointerType (T)) {
508
- const BlockPointerType *BPT = T->getAs <BlockPointerType>();
508
+ const auto *BPT = T->castAs <BlockPointerType>();
509
509
T = Context->getPointerType (BPT->getPointeeType ());
510
510
return true ;
511
511
}
@@ -856,8 +856,7 @@ RewriteModernObjC::getIvarAccessString(ObjCIvarDecl *D) {
856
856
RD = RD->getDefinition ();
857
857
if (RD && !RD->getDeclName ().getAsIdentifierInfo ()) {
858
858
// decltype(((Foo_IMPL*)0)->bar) *
859
- ObjCContainerDecl *CDecl =
860
- dyn_cast<ObjCContainerDecl>(D->getDeclContext ());
859
+ auto *CDecl = cast<ObjCContainerDecl>(D->getDeclContext ());
861
860
// ivar in class extensions requires special treatment.
862
861
if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(CDecl))
863
862
CDecl = CatDecl->getClassInterface ();
@@ -1332,6 +1331,7 @@ void RewriteModernObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl,
1332
1331
void RewriteModernObjC::RewriteImplementationDecl (Decl *OID) {
1333
1332
ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID);
1334
1333
ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID);
1334
+ assert ((IMD || CID) && " Unknown implementation type" );
1335
1335
1336
1336
if (IMD) {
1337
1337
if (IMD->getIvarRBraceLoc ().isValid ()) {
@@ -2103,8 +2103,7 @@ RewriteModernObjC::SynthesizeCallToFunctionDecl(FunctionDecl *FD,
2103
2103
ImplicitCastExpr::Create (*Context, pToFunc, CK_FunctionToPointerDecay,
2104
2104
DRE, nullptr , VK_RValue);
2105
2105
2106
- const FunctionType *FT = msgSendType->getAs <FunctionType>();
2107
-
2106
+ const auto *FT = msgSendType->castAs <FunctionType>();
2108
2107
CallExpr *Exp = CallExpr::Create (
2109
2108
*Context, ICE, Args, FT->getCallResultType (*Context), VK_RValue, EndLoc);
2110
2109
return Exp;
0 commit comments