diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-23 18:08:50 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-23 18:08:50 +0000 |
commit | 3131496622ba071ec34d58da48d07f990430425f (patch) | |
tree | dc39acce5e6fd2c15154e65dcc9ab445acebd52d /clang/lib/CodeGen/CGExprComplex.cpp | |
parent | 3968c6a2528e061bd95173be8eac18fda3e21230 (diff) | |
download | bcm5719-llvm-3131496622ba071ec34d58da48d07f990430425f.tar.gz bcm5719-llvm-3131496622ba071ec34d58da48d07f990430425f.zip |
Patch to implement code gen. use of compound assignent on
properties of complex type. Radar 7351147.
llvm-svn: 99299
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 591534042f5..ee104b76356 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -522,13 +522,20 @@ EmitCompoundAssign(const CompoundAssignOperator *E, // scalar. OpInfo.Ty = E->getComputationResultType(); 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. - OpInfo.LHS=EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified()); - OpInfo.LHS=EmitComplexToComplexCast(OpInfo.LHS, LHSTy, OpInfo.Ty); + ComplexPairTy LHSComplexPair; + if (LHSLV.isPropertyRef()) + LHSComplexPair = + CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal(); + else + LHSComplexPair = EmitLoadOfComplex(LHSLV.getAddress(), + LHSLV.isVolatileQualified()); + + OpInfo.LHS=EmitComplexToComplexCast(LHSComplexPair, LHSTy, OpInfo.Ty); // Expand the binary operator. ComplexPairTy Result = (this->*Func)(OpInfo); @@ -537,12 +544,18 @@ EmitCompoundAssign(const CompoundAssignOperator *E, Result = EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy); // Store the result value into the LHS lvalue. - EmitStoreOfComplex(Result, LHSLV.getAddress(), LHSLV.isVolatileQualified()); + if (LHSLV.isPropertyRef()) + CGF.EmitObjCPropertySet(LHSLV.getPropertyRefExpr(), + RValue::getComplex(Result)); + else + EmitStoreOfComplex(Result, LHSLV.getAddress(), LHSLV.isVolatileQualified()); // And now return the LHS IgnoreReal = ignreal; IgnoreImag = ignimag; IgnoreRealAssign = ignreal; IgnoreImagAssign = ignimag; + if (LHSLV.isPropertyRef()) + return CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal(); return EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified()); } |