aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
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() {}