Implemented ir-gen for 'implicit' properties using the new AST nodes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 4f2bd48..4ad698a 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -132,6 +132,8 @@
     return EmitObjCIvarRefLValue(cast<ObjCIvarRefExpr>(E));
   case Expr::ObjCPropertyRefExprClass:
     return EmitObjCPropertyRefLValue(cast<ObjCPropertyRefExpr>(E));
+  case Expr::ObjCKVCRefExprClass:
+    return EmitObjCKVCRefLValue(cast<ObjCKVCRefExpr>(E));
   case Expr::ObjCSuperExprClass:
     return EmitObjCSuperExpr(cast<ObjCSuperExpr>(E));
 
@@ -199,6 +201,9 @@
   if (LV.isPropertyRef())
     return EmitLoadOfPropertyRefLValue(LV, ExprType);
 
+  if (LV.isKVCRef())
+    return EmitLoadOfKVCRefLValue(LV, ExprType);
+
   assert(0 && "Unknown LValue type!");
   //an invalid RValue, but the assert will
   //ensure that this point is never reached
@@ -274,6 +279,11 @@
   return EmitObjCPropertyGet(LV.getPropertyRefExpr());
 }
 
+RValue CodeGenFunction::EmitLoadOfKVCRefLValue(LValue LV,
+                                               QualType ExprType) {
+  return EmitObjCPropertyGet(LV.getKVCRefExpr());
+}
+
 // If this is a reference to a subset of the elements of a vector, either
 // shuffle the input or extract/insert them as appropriate.
 RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
@@ -357,6 +367,9 @@
     if (Dst.isPropertyRef())
       return EmitStoreThroughPropertyRefLValue(Src, Dst, Ty);
 
+    if (Dst.isKVCRef())
+      return EmitStoreThroughKVCRefLValue(Src, Dst, Ty);
+
     assert(0 && "Unknown LValue type");
   }
   
@@ -491,6 +504,12 @@
   EmitObjCPropertySet(Dst.getPropertyRefExpr(), Src);
 }
 
+void CodeGenFunction::EmitStoreThroughKVCRefLValue(RValue Src,
+                                                   LValue Dst,
+                                                   QualType Ty) {
+  EmitObjCPropertySet(Dst.getKVCRefExpr(), Src);
+}
+
 void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
                                                                LValue Dst,
                                                                QualType Ty) {
@@ -973,6 +992,13 @@
   return LValue::MakePropertyRef(E, E->getType().getCVRQualifiers());
 }
 
+LValue 
+CodeGenFunction::EmitObjCKVCRefLValue(const ObjCKVCRefExpr *E) {
+  // This is a special l-value that just issues sends when we load or
+  // store through it.
+  return LValue::MakeKVCRef(E, E->getType().getCVRQualifiers());
+}
+
 LValue
 CodeGenFunction::EmitObjCSuperExpr(const ObjCSuperExpr *E) {
   return EmitUnsupportedLValue(E, "use of super");