diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-22 22:30:21 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-22 22:30:21 +0000 |
commit | 43f447098d5e6162fbfb97ed38365284207a7fbe (patch) | |
tree | d47eaf5853b61178aa80a6ae24d317553ca1f6ba /lib/CodeGen/CGObjC.cpp | |
parent | 6816856fb1feaf3a8add3d5cd99ec19339849c4e (diff) |
Implemented ir-gen for 'implicit' properties using the new AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
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) |