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
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index bdbd5ca..a7a64e3 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -146,6 +146,12 @@
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());
}
}