diff options
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 040a9219087..e631bac452e 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/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. /// |