Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142914 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 97754d5..0fa1433 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -326,7 +326,8 @@
   }
 
   case CK_GetObjCProperty: {
-    LValue LV = CGF.EmitLValue(E->getSubExpr());
+    LValue LV =
+      CGF.EmitObjCPropertyRefLValue(E->getSubExpr()->getObjCProperty());
     assert(LV.isPropertyRef());
     RValue RV = CGF.EmitLoadOfPropertyRefLValue(LV, getReturnValueSlot());
     EmitMoveFromReturnSlot(E, RV);
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 4a31bcf..b6c416b 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -363,7 +363,7 @@
   case CK_Dependent: llvm_unreachable("dependent cast kind in IR gen!");
 
   case CK_GetObjCProperty: {
-    LValue LV = CGF.EmitLValue(Op);
+    LValue LV = CGF.EmitObjCPropertyRefLValue(Op->getObjCProperty());
     assert(LV.isPropertyRef() && "Unknown LValue type!");
     return CGF.EmitLoadOfPropertyRefLValue(LV).getComplexVal();
   }
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index b088103..582d1c4 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1167,10 +1167,10 @@
     break;
 
   case CK_GetObjCProperty: {
-    assert(CGF.getContext().hasSameUnqualifiedType(E->getType(), DestTy));
     assert(E->isGLValue() && E->getObjectKind() == OK_ObjCProperty &&
            "CK_GetObjCProperty for non-lvalue or non-ObjCProperty");
-    RValue RV = CGF.EmitLoadOfLValue(CGF.EmitLValue(E));
+    LValue LV = CGF.EmitObjCPropertyRefLValue(E->getObjCProperty());
+    RValue RV = CGF.EmitLoadOfPropertyRefLValue(LV);
     return RV.getScalarVal();
   }