aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 183d9a9a24..4836be4b8e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1814,12 +1814,11 @@ QualType Sema::TryFixInvalidVariablyModifiedType(QualType T) {
if (const VariableArrayType* VLATy = dyn_cast<VariableArrayType>(T)) {
APValue Result;
if (VLATy->getSizeExpr() &&
- VLATy->getSizeExpr()->tryEvaluate(Result, Context) && Result.isSInt() &&
- Result.getSInt() > llvm::APSInt(Result.getSInt().getBitWidth(),
- Result.getSInt().isUnsigned())) {
- return Context.getConstantArrayType(VLATy->getElementType(),
- Result.getSInt(),
- ArrayType::Normal, 0);
+ VLATy->getSizeExpr()->tryEvaluate(Result, Context) && Result.isInt()) {
+ llvm::APSInt &Res = Result.getInt();
+ if (Res > llvm::APSInt(Res.getBitWidth(), Res.isUnsigned()))
+ return Context.getConstantArrayType(VLATy->getElementType(),
+ Res, ArrayType::Normal, 0);
}
}
return QualType();