aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-12-01 02:46:24 +0000
committerAnders Carlsson <andersca@mac.com>2008-12-01 02:46:24 +0000
commit64712f196bffd41fb0552c2643b07a25c3e45082 (patch)
treea2fcd7b0a8fd59b6dfa2833208daccf7499da0fa /lib/CodeGen
parent4b3f9c06d548d3de576441a91ef986c6840bd983 (diff)
Change more code over to using the new Expr::Evaluate
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 534adfe5bb..fe88bc9127 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -194,19 +194,17 @@ bool CodeGenFunction::ContainsLabel(const Stmt *S, bool IgnoreCaseStmts) {
/// folds to 'true' and does not contain a label, return 1, if it constant folds
/// to 'false' and does not contain a label, return -1.
int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
- APValue V;
-
// FIXME: Rename and handle conversion of other evaluatable things
// to bool.
- bool isEvaluated;
- if (!Cond->Evaluate(V, getContext(), &isEvaluated) || !V.isInt() ||
- !isEvaluated)
+ Expr::EvalResult Result;
+ if (!Cond->Evaluate(Result, getContext()) || !Result.Val.isInt() ||
+ Result.HasSideEffects)
return 0; // Not foldable, not integer or not fully evaluatable.
if (CodeGenFunction::ContainsLabel(Cond))
return 0; // Contains a label.
- return V.getInt().getBoolValue() ? 1 : -1;
+ return Result.Val.getInt().getBoolValue() ? 1 : -1;
}