diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2009-03-04 05:52:32 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2009-03-04 05:52:32 +0000 |
| commit | e0a5b8b11f4f4ea7e637659ea3ef9801a6d2b6ea (patch) | |
| tree | 9c3b1515397187f2801a59244a138f024f70b705 /clang/lib/AST/Expr.cpp | |
| parent | 1a84994c4617af3971ac889a192a10647131fa1b (diff) | |
| download | bcm5719-llvm-e0a5b8b11f4f4ea7e637659ea3ef9801a6d2b6ea.tar.gz bcm5719-llvm-e0a5b8b11f4f4ea7e637659ea3ef9801a6d2b6ea.zip | |
Minor cleanup for choose expressions: add a helper that returns the
chosen sub-expression, rather than just evaluating the condition.
llvm-svn: 66018
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index d0d14f2b7af..38bcc9bf315 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -603,11 +603,7 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const { return LV_Valid; case ChooseExprClass: // __builtin_choose_expr is an lvalue if the selected operand is. - if (cast<ChooseExpr>(this)->isConditionTrue(Ctx)) - return cast<ChooseExpr>(this)->getLHS()->isLvalue(Ctx); - else - return cast<ChooseExpr>(this)->getRHS()->isLvalue(Ctx); - + return cast<ChooseExpr>(this)->getChosenSubExpr(Ctx)->isLvalue(Ctx); case ExtVectorElementExprClass: if (cast<ExtVectorElementExpr>(this)->containsDuplicateElements()) return LV_DuplicateVectorComponents; @@ -1110,9 +1106,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { case Expr::CXXDefaultArgExprClass: return CheckICE(cast<CXXDefaultArgExpr>(E)->getExpr(), Ctx); case Expr::ChooseExprClass: { - const ChooseExpr *CE = cast<ChooseExpr>(E); - Expr *SubExpr = CE->isConditionTrue(Ctx) ? CE->getLHS() : CE->getRHS(); - return CheckICE(SubExpr, Ctx); + return CheckICE(cast<ChooseExpr>(E)->getChosenSubExpr(Ctx), Ctx); } } } |

