summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 6a7be0fe6e..ab88a38bab 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -216,10 +216,19 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
InitializedDecl);
}
+ if (const ObjCPropertyRefExpr *PRE =
+ dyn_cast<ObjCPropertyRefExpr>(E->IgnoreParenImpCasts()))
+ if (PRE->getGetterResultType()->isReferenceType())
+ E = PRE;
+
RValue RV;
if (E->isGLValue()) {
// Emit the expression as an lvalue.
LValue LV = CGF.EmitLValue(E);
+ if (LV.isPropertyRef()) {
+ RV = CGF.EmitLoadOfPropertyRefLValue(LV);
+ return RV.getScalarVal();
+ }
if (LV.isSimple())
return LV.getAddress();