[cfe-commits] r74637 - /cfe/trunk/lib/AST/ExprConstant.cpp

Daniel Dunbar daniel at zuster.org
Wed Jul 1 13:37:45 PDT 2009


Author: ddunbar
Date: Wed Jul  1 15:37:45 2009
New Revision: 74637

URL: http://llvm.org/viewvc/llvm-project?rev=74637&view=rev
Log:
Fix thinko in r74506, test condition for floats was inverted.
 - Refactored slightly to make control flow more obvious.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=74637&r1=74636&r2=74637&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Jul  1 15:37:45 2009
@@ -499,15 +499,15 @@
     return this->Visit(const_cast<Expr*>(SE));
   } else if (SETy->isIntegerType()) {
     APSInt IntResult;
-    if (EvaluateInteger(SE, IntResult, Info))
-      Result = APValue(IntResult);
+    if (!EvaluateInteger(SE, IntResult, Info))
+      return APValue();
+    Result = APValue(IntResult);
   } else if (SETy->isRealFloatingType()) {
     APFloat F(0.0);
-    if (EvaluateFloat(SE, F, Info))
-      Result = APValue(F);
-  }
-  
-  if (!Result.isInt() && Result.isFloat())
+    if (!EvaluateFloat(SE, F, Info))
+      return APValue();
+    Result = APValue(F);
+  } else
     return APValue();
 
   // For casts of a scalar to ExtVector, convert the scalar to the element type





More information about the cfe-commits mailing list