diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-01 20:37:45 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-01 20:37:45 +0000 |
commit | d906dc7605b2d6352e16c27a5d3fb5f1a1b44ac8 (patch) | |
tree | 57da9025411db4f76337b49a79c376db1a7ee712 /lib/AST/ExprConstant.cpp | |
parent | df35d7f1916140bfed5ab0bad2d5e2bc62c667e5 (diff) |
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
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index ec2005a99f..eb6b5b725f 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -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 |