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
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 93567a4..cec75de 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -218,4 +218,24 @@
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() {}