summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.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
commitb129ce9436c5e1227d6314d30d3bf65fa548a3f8 (patch)
treedae8292721fdbf4048322268a12f8dde335a2067 /lib/CodeGen/CodeGenFunction.cpp
parentcac72db70c186339da4d98ea8f3409668a040dc9 (diff)
downloadclang-b129ce9436c5e1227d6314d30d3bf65fa548a3f8.tar.gz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 7250bbc64d..600640f78c 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -1513,10 +1513,11 @@ bool CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond,
bool AllowLabels) {
// FIXME: Rename and handle conversion of other evaluatable things
// to bool.
- llvm::APSInt Int;
- if (!Cond->EvaluateAsInt(Int, getContext()))
+ Expr::EvalResult Result;
+ if (!Cond->EvaluateAsInt(Result, getContext()))
return false; // Not foldable, not integer or not fully evaluatable.
+ llvm::APSInt Int = Result.Val.getInt();
if (!AllowLabels && CodeGenFunction::ContainsLabel(Cond))
return false; // Contains a label.