Fix thinko in r74506, test condition for floats was inverted.
- 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
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index ec2005a..eb6b5b7 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -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