diff options
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index d76592438b..f3a290cb8d 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -5772,14 +5772,13 @@ static bool IsTailPaddedMemberArray(Sema &S, llvm::APInt Size, while (TInfo) { TypeLoc TL = TInfo->getTypeLoc(); // Look through typedefs. - const TypedefTypeLoc *TTL = dyn_cast<TypedefTypeLoc>(&TL); - if (TTL) { - const TypedefNameDecl *TDL = TTL->getTypedefNameDecl(); + if (TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>()) { + const TypedefNameDecl *TDL = TTL.getTypedefNameDecl(); TInfo = TDL->getTypeSourceInfo(); continue; } - if (const ConstantArrayTypeLoc *CTL = dyn_cast<ConstantArrayTypeLoc>(&TL)) { - const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL->getSizeExpr()); + if (ConstantArrayTypeLoc CTL = TL.getAs<ConstantArrayTypeLoc>()) { + const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr()); if (!SizeExpr || SizeExpr->getExprLoc().isMacroID()) return false; } |