diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2008-11-16 22:06:39 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2008-11-16 22:06:39 +0000 |
commit | a25bd55e63b9ab26ca69390533356aaae7f1a40e (patch) | |
tree | 9026a8defdb3fc15fb28a6132cec6bdabb30e829 /lib/AST/ExprConstant.cpp | |
parent | ccc3fce5697e33f005990f9795e1c7cb8b4559ec (diff) |
use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 727678662d..07f6c5476d 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -730,11 +730,11 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) { } bool IntExprEvaluator::VisitConditionalOperator(const ConditionalOperator *E) { - llvm::APSInt Cond(32); - if (!EvaluateInteger(E->getCond(), Cond, Info)) + bool Cond; + if (!HandleConversionToBool(E->getCond(), Cond, Info)) return false; - return Visit(Cond != 0 ? E->getTrueExpr() : E->getFalseExpr()); + return Visit(Cond ? E->getTrueExpr() : E->getFalseExpr()); } /// VisitSizeAlignOfExpr - Evaluate a sizeof or alignof with a result as the |