summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-03-20 19:18:21 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-03-20 19:18:21 +0000
commit391d4fc7f7d99d94d5005e97a970a4b63d3feb95 (patch)
treee4ea4d4a5edbd83dca033998ab1649a2338008c9 /clang/lib/CodeGen
parent9ffbe41a6c7aeefeb15119ae66fbb9d576d949a1 (diff)
downloadbcm5719-llvm-391d4fc7f7d99d94d5005e97a970a4b63d3feb95.tar.gz
bcm5719-llvm-391d4fc7f7d99d94d5005e97a970a4b63d3feb95.zip
More super dot-syntax property implementation
when there is actually a property declaration used in the dot-syntax. llvm-svn: 67391
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp72
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h2
2 files changed, 48 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 84d60ea7df9..7f5262df1d4 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -315,10 +315,29 @@ QualType CodeGenFunction::TypeOfSelfObject() {
return PTy->getPointeeType();
}
+RValue CodeGenFunction::EmitObjCSuperPropertyGet(const Expr *Exp,
+ const Selector &S) {
+ llvm::Value *Receiver = LoadObjCSelf();
+ const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
+ bool isClassMessage = OMD->isClassMethod();
+ bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->getDeclContext());
+ return CGM.getObjCRuntime().GenerateMessageSendSuper(*this,
+ Exp->getType(),
+ S,
+ OMD->getClassInterface(),
+ isCategoryImpl,
+ Receiver,
+ isClassMessage,
+ CallArgList());
+
+}
+
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();
+ if (isa<ObjCSuperExpr>(E->getBase()))
+ return EmitObjCSuperPropertyGet(E, S);
return CGM.getObjCRuntime().
GenerateMessageSend(*this, Exp->getType(), S,
EmitScalarExpr(E->getBase()),
@@ -332,20 +351,8 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) {
const ObjCInterfaceDecl *OID = KE->getClassProp();
Receiver = CGM.getObjCRuntime().GetClass(Builder, OID);
}
- else if (isa<ObjCSuperExpr>(KE->getBase())) {
- Receiver = LoadObjCSelf();
- const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
- bool isClassMessage = OMD->isClassMethod();
- bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->getDeclContext());
- return CGM.getObjCRuntime().GenerateMessageSendSuper(*this,
- KE->getType(),
- S,
- OMD->getClassInterface(),
- isCategoryImpl,
- Receiver,
- isClassMessage,
- CallArgList());
- }
+ else if (isa<ObjCSuperExpr>(KE->getBase()))
+ return EmitObjCSuperPropertyGet(KE, S);
else
Receiver = EmitScalarExpr(KE->getBase());
return CGM.getObjCRuntime().
@@ -355,11 +362,35 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) {
}
}
+void CodeGenFunction::EmitObjCSuperPropertySet(const Expr *Exp,
+ const Selector &S,
+ RValue Src) {
+ CallArgList Args;
+ llvm::Value *Receiver = LoadObjCSelf();
+ const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
+ bool isClassMessage = OMD->isClassMethod();
+ bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->getDeclContext());
+ Args.push_back(std::make_pair(Src, Exp->getType()));
+ CGM.getObjCRuntime().GenerateMessageSendSuper(*this,
+ Exp->getType(),
+ S,
+ OMD->getClassInterface(),
+ isCategoryImpl,
+ Receiver,
+ isClassMessage,
+ Args);
+ return;
+}
+
void CodeGenFunction::EmitObjCPropertySet(const Expr *Exp,
RValue Src) {
// FIXME: Split it into two separate routines.
if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
Selector S = E->getProperty()->getSetterName();
+ if (isa<ObjCSuperExpr>(E->getBase())) {
+ EmitObjCSuperPropertySet(E, S, Src);
+ return;
+ }
CallArgList Args;
Args.push_back(std::make_pair(Src, E->getType()));
CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S,
@@ -375,18 +406,7 @@ void CodeGenFunction::EmitObjCPropertySet(const Expr *Exp,
Receiver = CGM.getObjCRuntime().GetClass(Builder, OID);
}
else if (isa<ObjCSuperExpr>(E->getBase())) {
- Receiver = LoadObjCSelf();
- const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
- bool isClassMessage = OMD->isClassMethod();
- bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->getDeclContext());
- CGM.getObjCRuntime().GenerateMessageSendSuper(*this,
- E->getType(),
- S,
- OMD->getClassInterface(),
- isCategoryImpl,
- Receiver,
- isClassMessage,
- Args);
+ EmitObjCSuperPropertySet(E, S, Src);
return;
}
else
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 8b578a6f394..a54e187658b 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -673,7 +673,9 @@ public:
llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E);
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E);
RValue EmitObjCPropertyGet(const Expr *E);
+ RValue EmitObjCSuperPropertyGet(const Expr *Exp, const Selector &S);
void EmitObjCPropertySet(const Expr *E, RValue Src);
+ void EmitObjCSuperPropertySet(const Expr *E, const Selector &S, RValue Src);
//===--------------------------------------------------------------------===//
OpenPOWER on IntegriCloud