diff options
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 226ec9917c..efdb0db129 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -279,25 +279,46 @@ llvm::Value *CodeGenFunction::LoadObjCSelf() { } RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) { + // FIXME: Split it into two separate routines. if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) { Selector S = E->getProperty()->getGetterName(); - return CGM.getObjCRuntime(). - GenerateMessageSend(*this, E->getType(), S, - EmitScalarExpr(E->getBase()), - false, CallArgList()); + GenerateMessageSend(*this, Exp->getType(), S, + EmitScalarExpr(E->getBase()), + false, CallArgList()); + } + else if (const ObjCKVCRefExpr *E = dyn_cast<ObjCKVCRefExpr>(Exp)) { + Selector S = E->getGetterMethod()->getSelector(); + return CGM.getObjCRuntime(). + GenerateMessageSend(*this, Exp->getType(), S, + EmitScalarExpr(E->getBase()), + false, CallArgList()); } - assert (0); + else + assert (0 && "bad expression node in EmitObjCPropertyGet"); } -void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E, +void CodeGenFunction::EmitObjCPropertySet(const Expr *Exp, RValue Src) { - Selector S = E->getProperty()->getSetterName(); - CallArgList Args; - Args.push_back(std::make_pair(Src, E->getType())); - CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S, - EmitScalarExpr(E->getBase()), - false, Args); + // FIXME: Split it into two separate routines. + if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) { + Selector S = E->getProperty()->getSetterName(); + CallArgList Args; + Args.push_back(std::make_pair(Src, E->getType())); + CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S, + EmitScalarExpr(E->getBase()), + false, Args); + } + else if (const ObjCKVCRefExpr *E = dyn_cast<ObjCKVCRefExpr>(Exp)) { + Selector S = E->getSetterMethod()->getSelector(); + CallArgList Args; + Args.push_back(std::make_pair(Src, E->getType())); + CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S, + EmitScalarExpr(E->getBase()), + false, Args); + } + else + assert (0 && "bad expression node in EmitObjCPropertySet"); } void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S) |