summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2018-11-20 23:24:16 +0000
committerBill Wendling <isanbard@gmail.com>2018-11-20 23:24:16 +0000
commit830bf59980144075051ac2bf68fd4ce32c6d4e24 (patch)
tree3873483cafebb3632077ba434e3755e393ca1004 /lib/CodeGen/CodeGenFunction.cpp
parent28b62f1a2418f7895c828b5c9ce068e699702566 (diff)
downloadclang-830bf59980144075051ac2bf68fd4ce32c6d4e24.tar.gz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347364 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.