]> granicus.if.org Git - clang/commitdiff
use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)
authorNuno Lopes <nunoplopes@sapo.pt>
Sun, 16 Nov 2008 22:06:39 +0000 (22:06 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Sun, 16 Nov 2008 22:06:39 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59429 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index 727678662db4b8af6c7e9cf32374941f50c920b7..07f6c5476d05c05953759273dbd4186c2a99550d 100644 (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