summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2013-02-06 00:58:34 +0000
committerChad Rosier <mcrosier@apple.com>2013-02-06 00:58:34 +0000
commit70299928079fe7d372e0b934dfcaaae6c947f193 (patch)
tree612ccdfb951d8e519a2e13a5dde93e9d69c73a72 /clang/lib/Sema/SemaChecking.cpp
parent906ba47143e7291231cf7ea606d9a55cbba1ceb7 (diff)
downloadbcm5719-llvm-70299928079fe7d372e0b934dfcaaae6c947f193.tar.gz
bcm5719-llvm-70299928079fe7d372e0b934dfcaaae6c947f193.zip
Use a dyn_cast to avoid a crash when the TypeLoc is not a ConstantArrayTypeLoc.
rdar://13153516 llvm-svn: 174477
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8db183105e5..800f64cd5cd 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5777,10 +5777,11 @@ static bool IsTailPaddedMemberArray(Sema &S, llvm::APInt Size,
TInfo = TDL->getTypeSourceInfo();
continue;
}
- ConstantArrayTypeLoc CTL = cast<ConstantArrayTypeLoc>(TL);
- const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL.getSizeExpr());
- if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
- return false;
+ if (const ConstantArrayTypeLoc *CTL = dyn_cast<ConstantArrayTypeLoc>(&TL)) {
+ const Expr *SizeExpr = dyn_cast<IntegerLiteral>(CTL->getSizeExpr());
+ if (!SizeExpr || SizeExpr->getExprLoc().isMacroID())
+ return false;
+ }
break;
}
OpenPOWER on IntegriCloud