summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8628645e94791a399533ee8b738ca13e6b224d90 (patch)
tree7ee9d2b37027ce2de348df57547f19bcf42cea4f /clang/lib/CodeGen
parent38eef1de6c4a2eddd62d5c9115161baaeb909a32 (diff)
downloadbcm5719-llvm-8628645e94791a399533ee8b738ca13e6b224d90.tar.gz
bcm5719-llvm-8628645e94791a399533ee8b738ca13e6b224d90.zip
Change more code over to using the new Expr::Evaluate
llvm-svn: 60324
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 534adfe5bb4..fe88bc91272 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud