aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-03 00:27:26 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-03 00:27:26 +0000
commite66f4e3e3ae9d7d11b0c302211066fad69228aba (patch)
treeebf694ed165de059748450009d609ec820a3be27 /lib/CodeGen/CGObjC.cpp
parent7e8cc57bad2b670b0a3b48fa3d84dce79b5c7288 (diff)
Fix ObjCPropertRefExpr to be able to encode all the information for
uses which refer to methods not properties. - Not yet wired in Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 5376d0f3c7..af79b66106 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -16,6 +16,7 @@
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/STLExtras.h"
using namespace clang;
@@ -231,10 +232,10 @@ llvm::Value *CodeGenFunction::LoadObjCSelf(void) {
RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E) {
// Determine getter selector.
Selector S;
- if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(E->getDecl())) {
- S = MD->getSelector();
+ if (E->getKind() == ObjCPropertyRefExpr::MethodRef) {
+ S = E->getGetterMethod()->getSelector();
} else {
- S = cast<ObjCPropertyDecl>(E->getDecl())->getGetterName();
+ S = E->getProperty()->getGetterName();
}
return CGM.getObjCRuntime().
@@ -246,12 +247,21 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E) {
void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E,
RValue Src) {
Selector S;
- if (const ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(E->getDecl())) {
- S = PD->getSetterName();
+ if (E->getKind() == ObjCPropertyRefExpr::MethodRef) {
+ ObjCMethodDecl *Setter = E->getSetterMethod();
+
+ if (Setter) {
+ S = Setter->getSelector();
+ } else {
+ // FIXME: This should be diagnosed by sema.
+ SourceRange Range = E->getSourceRange();
+ CGM.getDiags().Report(getContext().getFullLoc(E->getLocStart()),
+ diag::err_typecheck_assign_const, 0, 0,
+ &Range, 1);
+ return;
+ }
} else {
- // FIXME: How can we have a method decl here?
- ErrorUnsupported(E, "Objective-C property setter call");
- return;
+ S = E->getProperty()->getSetterName();
}
CallArgList Args;