diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c309f043643767..459343637318d0 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2836,8 +2836,10 @@ static void handleSentinelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { QualType Ty = V->getType(); if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) { const FunctionType *FT = Ty->isFunctionPointerType() - ? D->getFunctionType() - : Ty->castAs()->getPointeeType()->getAs(); + ? D->getFunctionType() + : Ty->castAs() + ->getPointeeType() + ->castAs(); if (!cast(FT)->isVariadic()) { int m = Ty->isFunctionPointerType() ? 0 : 1; S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m; @@ -5836,7 +5838,7 @@ static void checkSwiftAsyncErrorBlock(Sema &S, Decl *D, // handleSwiftAsyncAttr already verified the type is correct, so no need to // double-check it here. const auto *FuncTy = HandlerParam->getType() - ->getAs() + ->castAs() ->getPointeeType() ->getAs(); ArrayRef BlockParams; @@ -6313,8 +6315,8 @@ static void handleSwiftAsyncAttr(Sema &S, Decl *D, const ParsedAttr &AL) { return; } QualType BlockTy = - CompletionBlockType->getAs()->getPointeeType(); - if (!BlockTy->getAs()->getReturnType()->isVoidType()) { + CompletionBlockType->castAs()->getPointeeType(); + if (!BlockTy->castAs()->getReturnType()->isVoidType()) { S.Diag(CompletionBlock->getLocation(), diag::err_swift_async_bad_block_type) << CompletionBlock->getType();