]> granicus.if.org Git - clang/commitdiff
Change more code over to using the new Expr::Evaluate
authorAnders Carlsson <andersca@mac.com>
Mon, 1 Dec 2008 02:46:24 +0000 (02:46 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 1 Dec 2008 02:46:24 +0000 (02:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60324 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 534adfe5bb4968e13b06e9aa77ea434aec35e62c..fe88bc9127276570ae50c4c7cff64e6cce8a332d 100644 (file)
@@ -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;
 }