aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-11-22 22:32:07 +0000
committerAnders Carlsson <andersca@mac.com>2008-11-22 22:32:07 +0000
commitef5a66d8171eb95e948107f8ee7707b360aaff25 (patch)
tree1428d9138dc4f0c52e7c632053392b571e0c8c0e /lib/CodeGen/CodeGenFunction.cpp
parent43f447098d5e6162fbfb97ed38365284207a7fbe (diff)
An expression is not foldable if it can't be fully evaluated. Fixes PR3060
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index b358993665..b56b050c14 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -197,8 +197,10 @@ int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
// FIXME: Rename and handle conversion of other evaluatable things
// to bool.
- if (!Cond->Evaluate(V, getContext()) || !V.isInt())
- return 0; // Not foldable or not integer.
+ bool isEvaluated;
+ if (!Cond->Evaluate(V, getContext(), &isEvaluated) || !V.isInt() ||
+ !isEvaluated)
+ return 0; // Not foldable, not integer or not fully evaluatable.
if (CodeGenFunction::ContainsLabel(Cond))
return 0; // Contains a label.