diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-06 03:04:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-06 03:04:50 +0000 |
commit | 7808c6aa7e929486c289608edb1f9a1efc3e5c8a (patch) | |
tree | fac97e82750d941df4f4159cb01fa80856fb44f1 /clang/lib/AST/ASTContext.cpp | |
parent | 7964ab5e49d25cfd16c51cee9911f6b036ac488c (diff) | |
download | bcm5719-llvm-7808c6aa7e929486c289608edb1f9a1efc3e5c8a.tar.gz bcm5719-llvm-7808c6aa7e929486c289608edb1f9a1efc3e5c8a.zip |
Don't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscure record layout bug.
llvm-svn: 169467
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index a1faaa00ec4..44f13b6906f 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3994,7 +3994,8 @@ ASTContext::getConstantArrayElementCount(const ConstantArrayType *CA) const { uint64_t ElementCount = 1; do { ElementCount *= CA->getSize().getZExtValue(); - CA = dyn_cast<ConstantArrayType>(CA->getElementType()); + CA = dyn_cast_or_null<ConstantArrayType>( + CA->getElementType()->getAsArrayTypeUnsafe()); } while (CA); return ElementCount; } |