summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-11-28 14:04:12 +0000
committerHans Wennborg <hans@hanshq.net>2018-11-28 14:04:12 +0000
commit48ee4ad3251d3e9998811e4a7bf85bf522b0e0d6 (patch)
tree9edab9060fcf90ca80bad874af9694abf7742bf8 /clang/lib/Sema/SemaDecl.cpp
parent1208240ac9d5eb00f7d6fe26d134081d5283e52c (diff)
downloadbcm5719-llvm-48ee4ad3251d3e9998811e4a7bf85bf522b0e0d6.tar.gz
bcm5719-llvm-48ee4ad3251d3e9998811e4a7bf85bf522b0e0d6.zip
Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."
This was reverted in r347656 due to me thinking it caused a miscompile of Chromium. Turns out it was the Chromium code that was broken. llvm-svn: 347756
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5c003ed6093..5c31589e0b2 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5575,11 +5575,13 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T,
if (VLATy->getElementType()->isVariablyModifiedType())
return QualType();
- llvm::APSInt Res;
+ Expr::EvalResult Result;
if (!VLATy->getSizeExpr() ||
- !VLATy->getSizeExpr()->EvaluateAsInt(Res, Context))
+ !VLATy->getSizeExpr()->EvaluateAsInt(Result, Context))
return QualType();
+ llvm::APSInt Res = Result.Val.getInt();
+
// Check whether the array size is negative.
if (Res.isSigned() && Res.isNegative()) {
SizeIsNegative = true;
OpenPOWER on IntegriCloud