use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)

llvm-svn: 59429
This commit is contained in:
Nuno Lopes 2008-11-16 22:06:39 +00:00
parent 9ddf7bedf9
commit 527b5a6858
1 changed files with 3 additions and 3 deletions

View File

@ -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