]> granicus.if.org Git - clang/commitdiff
Fix thinko in r74506, test condition for floats was inverted.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 1 Jul 2009 20:37:45 +0000 (20:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 1 Jul 2009 20:37:45 +0000 (20:37 +0000)
 - Refactored slightly to make control flow more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74637 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index ec2005a99fc95d1e021f31774239fc456f710d4d..eb6b5b725ff5913f7647f664f1d915bb10548fff 100644 (file)
@@ -499,15 +499,15 @@ APValue VectorExprEvaluator::VisitCastExpr(const CastExpr* E) {
     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