diff options
author | Bill Wendling <isanbard@gmail.com> | 2018-11-20 23:24:16 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2018-11-20 23:24:16 +0000 |
commit | 91549ed15f97f21de8770196e66da3d228820cdc (patch) | |
tree | a4a3c5ffe121d9c0fdcce151e96eba612d3c7ded /clang/lib/Sema/SemaDecl.cpp | |
parent | 8eb65cb25e67a2b426b94152f9c9bb3c1025b701 (diff) | |
download | bcm5719-llvm-91549ed15f97f21de8770196e66da3d228820cdc.tar.gz bcm5719-llvm-91549ed15f97f21de8770196e66da3d228820cdc.zip |
Reinstate 347294 with a fix for the failures.
EvaluateAsInt() is sometimes called in a constant context. When that's the
case, we need to specify it as so.
llvm-svn: 347364
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
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; |