diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-23 18:43:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-23 18:43:00 +0000 |
commit | 6c67b907529ac16baf1fac5d3da051351c990ff7 (patch) | |
tree | 124dfdce7b02e98c172ece2cf0fe2ab8e1d87f30 /clang | |
parent | 2b9735138e2f1ec5f742fbdc4c0762d5e48c60c3 (diff) | |
download | bcm5719-llvm-6c67b907529ac16baf1fac5d3da051351c990ff7.tar.gz bcm5719-llvm-6c67b907529ac16baf1fac5d3da051351c990ff7.zip |
Code gen for compound assignment of complex
types using property syntax to access setter/getters.
(also radar 7351147).
llvm-svn: 99307
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 9 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/complex-property.m | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index ee104b76356..0a0c9149b41 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -524,13 +524,14 @@ EmitCompoundAssign(const CompoundAssignOperator *E, 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 @@ EmitCompoundAssign(const CompoundAssignOperator *E, 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 @@ EmitCompoundAssign(const CompoundAssignOperator *E, 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()); } diff --git a/clang/test/CodeGenObjC/complex-property.m b/clang/test/CodeGenObjC/complex-property.m index 6d7cda19ec4..bd3bfea94b5 100644 --- a/clang/test/CodeGenObjC/complex-property.m +++ b/clang/test/CodeGenObjC/complex-property.m @@ -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 |