summaryrefslogtreecommitdiffstats
path: root/clang/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
commit4046e65b27c87ca2dd35c4690f4de6ea9eddaecf (patch)
tree29833d6b1cd0ed42fbf4c71fc27346c5796728ca /clang/lib/CodeGen/CodeGenFunction.cpp
parent9ac535162b9d984ea1e93b59a55fed79bdd33a29 (diff)
downloadbcm5719-llvm-4046e65b27c87ca2dd35c4690f4de6ea9eddaecf.tar.gz
bcm5719-llvm-4046e65b27c87ca2dd35c4690f4de6ea9eddaecf.zip
An expression is not foldable if it can't be fully evaluated. Fixes PR3060
llvm-svn: 59887
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index b358993665d..b56b050c144 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud