aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-27 06:57:25 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-27 06:57:25 +0000
commit9c3fc703b29a31d40bcf5027dbb4784dd393804e (patch)
treeacbfc451d53b7828a3f09c4bb5ddcab489fad7b8 /lib/CodeGen/CGObjC.cpp
parent8a7267ef413d84a907d178cee9eb32294cf6b13b (diff)
Initial support for Obj-C dot-syntax for getters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 93567a4f8f..cec75dea9b 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -218,4 +218,24 @@ llvm::Value *CodeGenFunction::LoadObjCSelf(void) {
return Builder.CreateLoad(LocalDeclMap[OMD->getSelfDecl()], "self");
}
+RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E) {
+ // Determine getter selector.
+ Selector S;
+ if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(E->getDecl())) {
+ S = MD->getSelector();
+ } else {
+ S = cast<ObjCPropertyDecl>(E->getDecl())->getGetterName();
+ }
+
+ // FIXME: Improve location information.
+ SourceLocation Loc = E->getLocation();
+ // PropertyRefExprs are always instance messages.
+ // FIXME: Is there any reason to try and pass the method here?
+ ObjCMessageExpr GetExpr(const_cast<Expr*>(E->getBase()),
+ S, E->getType(), 0, Loc, Loc,
+ 0, 0);
+
+ return EmitObjCMessageExpr(&GetExpr);
+}
+
CGObjCRuntime::~CGObjCRuntime() {}