[cfe-commits] r99307 - in /cfe/trunk: lib/CodeGen/CGExprComplex.cpp test/CodeGenObjC/complex-property.m

Fariborz Jahanian fjahanian at apple.com
Tue Mar 23 11:43:00 PDT 2010


Author: fjahanian
Date: Tue Mar 23 13:43:00 2010
New Revision: 99307

URL: http://llvm.org/viewvc/llvm-project?rev=99307&view=rev
Log:
Code gen for compound assignment of complex
types using property syntax to access setter/getters.
(also radar 7351147).

Modified:
    cfe/trunk/lib/CodeGen/CGExprComplex.cpp
    cfe/trunk/test/CodeGenObjC/complex-property.m

Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=99307&r1=99306&r2=99307&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Tue Mar 23 13:43:00 2010
@@ -524,13 +524,14 @@
   OpInfo.RHS = EmitCast(E->getRHS(), OpInfo.Ty);
   
   LValue LHSLV = CGF.EmitLValue(E->getLHS());
-  assert(!LHSLV.isKVCRef() && 
-         "setter/getter access of complex using property syntax NYI");
   // We know the LHS is a complex lvalue.
   ComplexPairTy LHSComplexPair;
   if (LHSLV.isPropertyRef())
     LHSComplexPair = 
       CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal();
+  else if (LHSLV.isKVCRef())
+    LHSComplexPair = 
+      CGF.EmitObjCPropertyGet(LHSLV.getKVCRefExpr()).getComplexVal();
   else
     LHSComplexPair = EmitLoadOfComplex(LHSLV.getAddress(), 
                                        LHSLV.isVolatileQualified());
@@ -547,6 +548,8 @@
   if (LHSLV.isPropertyRef())
     CGF.EmitObjCPropertySet(LHSLV.getPropertyRefExpr(), 
                             RValue::getComplex(Result));
+  else if (LHSLV.isKVCRef())
+    CGF.EmitObjCPropertySet(LHSLV.getKVCRefExpr(), RValue::getComplex(Result));
   else
     EmitStoreOfComplex(Result, LHSLV.getAddress(), LHSLV.isVolatileQualified());
   // And now return the LHS
@@ -556,6 +559,8 @@
   IgnoreImagAssign = ignimag;
   if (LHSLV.isPropertyRef())
     return CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal();
+  else if (LHSLV.isKVCRef())
+    return CGF.EmitObjCPropertyGet(LHSLV.getKVCRefExpr()).getComplexVal();
   return EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified());
 }
 

Modified: cfe/trunk/test/CodeGenObjC/complex-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/complex-property.m?rev=99307&r1=99306&r2=99307&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/complex-property.m (original)
+++ cfe/trunk/test/CodeGenObjC/complex-property.m Tue Mar 23 13:43:00 2010
@@ -3,11 +3,14 @@
 
 @interface A
 @property __complex int COMPLEX_PROP;
+- (__complex int)y;
+- (void) setY : (__complex int)rhs;
 @end
 
 void f0(A *a) {  
   _Complex int a1 = 25 + 10i;
   a.COMPLEX_PROP += a1;
+  a.y += a1;
 }
 
 // CHECK-LP64: internal global [13 x i8] c"COMPLEX_PROP





More information about the cfe-commits mailing list