summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-11-22 18:39:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-11-22 18:39:36 +0000
commit8a1810f06b3f1ff13c54658bcb34861b664a5776 (patch)
treefc89eea33d7ed90ba0955d98241a7129eff7e234 /clang/lib/CodeGen/CGObjC.cpp
parentbff4b37af513edeabc431266d5008a5f7f4073ca (diff)
downloadbcm5719-llvm-8a1810f06b3f1ff13c54658bcb34861b664a5776.tar.gz
bcm5719-llvm-8a1810f06b3f1ff13c54658bcb34861b664a5776.zip
New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties. This is work in progress. llvm-svn: 59874
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 4739efa63df..226ec9917c3 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -278,40 +278,21 @@ llvm::Value *CodeGenFunction::LoadObjCSelf() {
return Builder.CreateLoad(LocalDeclMap[OMD->getSelfDecl()], "self");
}
-RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E) {
- // Determine getter selector.
- Selector S;
- if (E->getKind() == ObjCPropertyRefExpr::MethodRef) {
- S = E->getGetterMethod()->getSelector();
- } else {
- S = E->getProperty()->getGetterName();
- }
+RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) {
+ if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
+ Selector S = E->getProperty()->getGetterName();
- return CGM.getObjCRuntime().
+ return CGM.getObjCRuntime().
GenerateMessageSend(*this, E->getType(), S,
EmitScalarExpr(E->getBase()),
false, CallArgList());
+ }
+ assert (0);
}
void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E,
RValue Src) {
- Selector S;
- if (E->getKind() == ObjCPropertyRefExpr::MethodRef) {
- ObjCMethodDecl *Setter = E->getSetterMethod();
-
- if (Setter) {
- S = Setter->getSelector();
- } else {
- // FIXME: This should be diagnosed by sema.
- CGM.getDiags().Report(getContext().getFullLoc(E->getLocStart()),
- diag::err_typecheck_assign_const)
- << E->getSourceRange();
- return;
- }
- } else {
- S = E->getProperty()->getSetterName();
- }
-
+ Selector S = E->getProperty()->getSetterName();
CallArgList Args;
Args.push_back(std::make_pair(Src, E->getType()));
CGM.getObjCRuntime().GenerateMessageSend(*this, getContext().VoidTy, S,
OpenPOWER on IntegriCloud