summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-12 05:35:08 +0000
committerChris Lattner <sabre@nondot.org>2008-12-12 05:35:08 +0000
commit670a62cd1d51042ea076cda5e93f26a1d8327fb3 (patch)
tree9bb39524063bf3b6401597a104dda72b392ea122 /lib/CodeGen/CGExpr.cpp
parentf345accce09fe4243310d0cb6a4a0fd09caee8cf (diff)
downloadclang-670a62cd1d51042ea076cda5e93f26a1d8327fb3.tar.gz
clang-670a62cd1d51042ea076cda5e93f26a1d8327fb3.tar.bz2
clang-670a62cd1d51042ea076cda5e93f26a1d8327fb3.tar.xz
Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index bdbd5caa08..a7a64e3860 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -146,6 +146,12 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
case Expr::MemberExprClass: return EmitMemberExpr(cast<MemberExpr>(E));
case Expr::CompoundLiteralExprClass:
return EmitCompoundLiteralLValue(cast<CompoundLiteralExpr>(E));
+ case Expr::ChooseExprClass:
+ // __builtin_choose_expr is the lvalue of the selected operand.
+ if (cast<ChooseExpr>(E)->isConditionTrue(getContext()))
+ return EmitLValue(cast<ChooseExpr>(E)->getLHS());
+ else
+ return EmitLValue(cast<ChooseExpr>(E)->getRHS());
}
}