From 35e564ed09d57b6ceae9022afaa77635b16da53e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 25 Oct 2007 00:29:32 +0000 Subject: Add a new ChooseExpr::isConditionTrue method to unify some code. llvm-svn: 43322 --- clang/CodeGen/CGExprComplex.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'clang/CodeGen/CGExprComplex.cpp') diff --git a/clang/CodeGen/CGExprComplex.cpp b/clang/CodeGen/CGExprComplex.cpp index f27519c8f57..aa66bb6dfbf 100644 --- a/clang/CodeGen/CGExprComplex.cpp +++ b/clang/CodeGen/CGExprComplex.cpp @@ -499,12 +499,8 @@ VisitConditionalOperator(const ConditionalOperator *E) { } 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()); } //===----------------------------------------------------------------------===// -- cgit v1.2.3