aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-11-25 21:48:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-11-25 21:48:26 +0000
commit31afbf02a381ae9c77d225aa54f972d152838b3a (patch)
tree0e0c1b2d9c42819eb9a6d36b7cf0233d7b1ae83f /lib/AST/DeclObjC.cpp
parent6669db9d80d77d10f101aa9f8e488bbd2d98f76c (diff)
Refactored checking on readonly property into a method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 040a921908..e631bac452 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -257,6 +257,26 @@ void ObjCMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo,
}
}
+/// isPropertyReadonly - Return true if property is a readonly, by seaching
+/// for the property in the class and in its categories.
+///
+bool ObjCInterfaceDecl::isPropertyReadonly(ObjCPropertyDecl *PDecl) const
+{
+ if (PDecl->isReadOnly()) {
+ // Main class has the property as 'readyonly'. Must search
+ // through the category list to see if the property's
+ // attribute has been over-ridden to 'readwrite'.
+ for (ObjCCategoryDecl *Category = getCategoryList();
+ Category; Category = Category->getNextClassCategory()) {
+ PDecl= Category->FindPropertyDeclaration(PDecl->getIdentifier());
+ if (PDecl && !PDecl->isReadOnly())
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
/// FindPropertyDeclaration - Finds declaration of the property given its name
/// in 'PropertyId' and returns it. It returns 0, if not found.
///