diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-10-25 00:29:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-10-25 00:29:32 +0000 |
| commit | 35e564ed09d57b6ceae9022afaa77635b16da53e (patch) | |
| tree | 22c679cf6a7213099d651a7a03318e54b70836dc /clang/CodeGen | |
| parent | 00974dce680fd63ddb25fab1fee2812a7a935b5a (diff) | |
| download | bcm5719-llvm-35e564ed09d57b6ceae9022afaa77635b16da53e.tar.gz bcm5719-llvm-35e564ed09d57b6ceae9022afaa77635b16da53e.zip | |
Add a new ChooseExpr::isConditionTrue method to unify
some code.
llvm-svn: 43322
Diffstat (limited to 'clang/CodeGen')
| -rw-r--r-- | clang/CodeGen/CGExprComplex.cpp | 6 | ||||
| -rw-r--r-- | clang/CodeGen/CGExprScalar.cpp | 6 |
2 files changed, 2 insertions, 10 deletions
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()); } //===----------------------------------------------------------------------===// diff --git a/clang/CodeGen/CGExprScalar.cpp b/clang/CodeGen/CGExprScalar.cpp index 4b45980d7e7..0d86ccc0224 100644 --- a/clang/CodeGen/CGExprScalar.cpp +++ b/clang/CodeGen/CGExprScalar.cpp @@ -903,12 +903,8 @@ VisitConditionalOperator(const ConditionalOperator *E) { } Value *ScalarExprEmitter::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()); } Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) |

