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

Daniel Dunbar daniel at zuster.org
Wed Nov 12 14:37:32 PST 2008


Author: ddunbar
Date: Wed Nov 12 16:37:10 2008
New Revision: 59184

URL: http://llvm.org/viewvc/llvm-project?rev=59184&view=rev
Log:
Quick fix for crash in IRgen when we can tryEvaluate a condition to
something that is not an int.

 - Ignore these cases for now, added FIXME that we should also boolize
   them.

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=59184&r1=59183&r2=59184&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Nov 12 16:37:10 2008
@@ -194,8 +194,11 @@
 /// to 'false' and does not contain a label, return -1.
 int CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond) {
   APValue V;
-  if (!Cond->tryEvaluate(V, getContext()))
-    return 0;  // Not foldable.
+  
+  // FIXME: Rename and handle conversion of other evaluatable things
+  // to bool.
+  if (!Cond->tryEvaluate(V, getContext()) || !V.isInt())
+    return 0;  // Not foldable or not integer.
   
   if (CodeGenFunction::ContainsLabel(Cond))
     return 0;  // Contains a label.





More information about the cfe-commits mailing list