Kill the KVC l-value kind and calculate the base expression when emitting
the l-value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120884 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 5784825..e1d042b 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -64,11 +64,8 @@
     if (LV.isSimple())
       return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified());
 
-    if (LV.isPropertyRef())
-      return CGF.EmitObjCPropertyGet(LV.getPropertyRefExpr()).getComplexVal();
-
-    assert(LV.isKVCRef() && "Unknown LValue type!");
-    return CGF.EmitObjCPropertyGet(LV.getKVCRefExpr()).getComplexVal();
+    assert(LV.isPropertyRef() && "Unknown LValue type!");
+    return CGF.EmitLoadOfPropertyRefLValue(LV).getComplexVal();
   }
 
   /// EmitLoadOfComplex - Given a pointer to a complex value, emit code to load
@@ -531,11 +528,7 @@
   // We know the LHS is a complex lvalue.
   ComplexPairTy LHSComplexPair;
   if (LHS.isPropertyRef())
-    LHSComplexPair =
-      CGF.EmitObjCPropertyGet(LHS.getPropertyRefExpr()).getComplexVal();
-  else if (LHS.isKVCRef())
-    LHSComplexPair =
-      CGF.EmitObjCPropertyGet(LHS.getKVCRefExpr()).getComplexVal();
+    LHSComplexPair = CGF.EmitLoadOfPropertyRefLValue(LHS).getComplexVal();
   else
     LHSComplexPair = EmitLoadOfComplex(LHS.getAddress(),
                                        LHS.isVolatileQualified());
@@ -551,10 +544,7 @@
 
   // Store the result value into the LHS lvalue.
   if (LHS.isPropertyRef())
-    CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(),
-                            RValue::getComplex(Result));
-  else if (LHS.isKVCRef())
-    CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Result));
+    CGF.EmitStoreThroughPropertyRefLValue(RValue::getComplex(Result), LHS);
   else
     EmitStoreOfComplex(Result, LHS.getAddress(), LHS.isVolatileQualified());
 
@@ -573,7 +563,7 @@
     return Val;
 
   // Objective-C property assignment never reloads the value following a store.
-  if (LV.isPropertyRef() || LV.isKVCRef())
+  if (LV.isPropertyRef())
     return Val;
 
   // If the lvalue is non-volatile, return the computed value of the assignment.
@@ -599,9 +589,7 @@
 
   // Store the result value into the LHS lvalue.
   if (LHS.isPropertyRef())
-    CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Val));
-  else if (LHS.isKVCRef())
-    CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Val));
+    CGF.EmitStoreThroughPropertyRefLValue(RValue::getComplex(Val), LHS);
   else
     EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified());
 
@@ -617,7 +605,7 @@
     return Val;
 
   // Objective-C property assignment never reloads the value following a store.
-  if (LV.isPropertyRef() || LV.isKVCRef())
+  if (LV.isPropertyRef())
     return Val;
 
   // If the lvalue is non-volatile, return the computed value of the assignment.