aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-01-10 18:43:55 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-01-10 18:43:55 +0000
commit212921261b9904d5b21c85c68a57c2b0d3f72b14 (patch)
treeb648065fa434ec0c83b83c40acfe0594e715cadb /lib/AST/DeclObjC.cpp
parentd2685209293a54fc2d888353c1fb839dcde616ef (diff)
Explicit declaration of property setters over-ride
prohibition of 'readonly' properties in an assignment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 56da9a6dfa..f39eec3dc5 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -257,7 +257,9 @@ void ObjCMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo,
///
bool ObjCInterfaceDecl::isPropertyReadonly(ObjCPropertyDecl *PDecl) const
{
- if (!PDecl->isReadOnly())
+ // Even if property is ready only, if interface has a user defined setter,
+ // it is not considered read only.
+ if (!PDecl->isReadOnly() || getInstanceMethod(PDecl->getSetterName()))
return false;
// Main class has the property as 'readonly'. Must search
@@ -265,6 +267,10 @@ bool ObjCInterfaceDecl::isPropertyReadonly(ObjCPropertyDecl *PDecl) const
// attribute has been over-ridden to 'readwrite'.
for (ObjCCategoryDecl *Category = getCategoryList();
Category; Category = Category->getNextClassCategory()) {
+ // Even if property is ready only, if a category has a user defined setter,
+ // it is not considered read only.
+ if (Category->getInstanceMethod(PDecl->getSetterName()))
+ return false;
ObjCPropertyDecl *P =
Category->FindPropertyDeclaration(PDecl->getIdentifier());
if (P && !P->isReadOnly())