Add a new ChooseExpr::isConditionTrue method to unify
some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43322 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprComplex.cpp b/CodeGen/CGExprComplex.cpp
index f27519c..aa66bb6 100644
--- a/CodeGen/CGExprComplex.cpp
+++ b/CodeGen/CGExprComplex.cpp
@@ -499,12 +499,8 @@
}
ComplexPairTy ComplexExprEmitter::VisitChooseExpr(ChooseExpr *E) {
- llvm::APSInt CondVal(32);
- bool IsConst = E->getCond()->isIntegerConstantExpr(CondVal, CGF.getContext());
- assert(IsConst && "Condition of choose expr must be i-c-e"); IsConst=IsConst;
-
// Emit the LHS or RHS as appropriate.
- return Visit(CondVal != 0 ? E->getLHS() : E->getRHS());
+ return Visit(E->isConditionTrue(CGF.getContext()) ? E->getLHS() :E->getRHS());
}
//===----------------------------------------------------------------------===//