if (E->isLvalue(CGF.getContext()) == Expr::LV_Valid) {
// Emit the expression as an lvalue.
LValue LV = CGF.EmitLValue(E);
-
+ if (LV.isPropertyRef() || LV.isKVCRef()) {
+ QualType QT = E->getType();
+ RValue RV =
+ LV.isPropertyRef() ? CGF.EmitLoadOfPropertyRefLValue(LV, QT)
+ : CGF.EmitLoadOfKVCRefLValue(LV, QT);
+ assert(RV.isScalar() && "EmitExprForReferenceBinding");
+ return RV.getScalarVal();
+ }
+
if (LV.isSimple())
return LV.getAddress();
self.node.GetURL();
} // expected-warning {{control reaches end of non-void function}}
@end
+
+// rdar://8437240
+struct X {
+ int x;
+};
+
+void f0(const X &parent);
+@interface A
+- (const X&) target;
+@end
+void f1(A *a) {
+// CHECK: [[PRP:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[PRP]])
+ f0(a.target);
+
+// CHECK: [[MSG:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[MSG]])
+ f0([a target]);
+}
+