[cfe-commits] r60324 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Anders Carlsson andersca at mac.com
Sun Nov 30 18:46:24 PST 2008


Author: andersca
Date: Sun Nov 30 20:46:24 2008
New Revision: 60324

URL: http://llvm.org/viewvc/llvm-project?rev=60324&view=rev
Log:
Change more code over to using the new Expr::Evaluate

Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=60324&r1=60323&r2=60324&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Nov 30 20:46:24 2008
@@ -194,19 +194,17 @@
 /// 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;
 }
 
 





More information about the cfe-commits mailing list