aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index f992dc7c9c..eb64996bd3 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -403,9 +403,17 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
// We have to special case property setters, otherwise we must have
// a simple lvalue (no aggregates inside vectors, bitfields).
if (LHS.isPropertyRef()) {
- AggValueSlot Slot = EnsureSlot(E->getRHS()->getType());
- CGF.EmitAggExpr(E->getRHS(), Slot);
- CGF.EmitStoreThroughPropertyRefLValue(Slot.asRValue(), LHS);
+ const ObjCPropertyRefExpr *RE = LHS.getPropertyRefExpr();
+ QualType ArgType = RE->getSetterArgType();
+ RValue Src;
+ if (ArgType->isReferenceType())
+ Src = CGF.EmitReferenceBindingToExpr(E->getRHS(), 0);
+ else {
+ AggValueSlot Slot = EnsureSlot(E->getRHS()->getType());
+ CGF.EmitAggExpr(E->getRHS(), Slot);
+ Src = Slot.asRValue();
+ }
+ CGF.EmitStoreThroughPropertyRefLValue(Src, LHS);
} else {
bool GCollection = false;
if (CGF.getContext().getLangOptions().getGCMode())