summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-12-20 21:03:38 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-12-20 21:03:38 +0000
commit4e246485a8bf9a0b5e471a86ec1f6ff11498a9e3 (patch)
tree93b47af93a9b4e9306581164e9feb1563188fdfd /clang/lib/AST/ExprConstant.cpp
parent3f84c0f5d835c322d5b5b82e35b29be664de25fa (diff)
downloadbcm5719-llvm-4e246485a8bf9a0b5e471a86ec1f6ff11498a9e3.tar.gz
bcm5719-llvm-4e246485a8bf9a0b5e471a86ec1f6ff11498a9e3.zip
Fix an assertion failure regression in isDesignatorAtObjectEnd for
__builtin_object_size with incomplete array type in struct The commit r316245 introduced a regression that causes an assertion failure when Clang tries to cast an IncompleteArrayType to a PointerType when evaluating __builtin_object_size. rdar://36094951 Differential Revision: https://reviews.llvm.org/D41405 llvm-svn: 321222
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 7b0b7317cd4..8d9b3c3bebc 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7420,7 +7420,10 @@ static bool isDesignatorAtObjectEnd(const ASTContext &Ctx, const LValue &LVal) {
// If we don't know the array bound, conservatively assume we're looking at
// the final array element.
++I;
- BaseType = BaseType->castAs<PointerType>()->getPointeeType();
+ if (BaseType->isIncompleteArrayType())
+ BaseType = Ctx.getAsArrayType(BaseType)->getElementType();
+ else
+ BaseType = BaseType->castAs<PointerType>()->getPointeeType();
}
for (unsigned E = LVal.Designator.Entries.size(); I != E; ++I) {
OpenPOWER on IntegriCloud