summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-02-21 19:41:39 +0000
committerTed Kremenek <kremenek@apple.com>2014-02-21 19:41:39 +0000
commit92856c23b572843ece0d6c23f68c0acfefad5de6 (patch)
tree273edce6fffb57f1f33f34e6c4190ed5ac505f07 /lib/Sema/SemaObjCProperty.cpp
parent829d0a80e3f7aa3e5b9000ebb09294e30b226af0 (diff)
[ObjC] add support for properties in attribute 'objc_protocol_requires_explicit_implementation'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 67be198f8d..9b3643a2ed 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1653,12 +1653,13 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
ObjCContainerDecl *CDecl,
bool SynthesizeProperties) {
ObjCContainerDecl::PropertyMap PropMap;
+ ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
+
if (!SynthesizeProperties) {
ObjCContainerDecl::PropertyMap NoNeedToImplPropMap;
- ObjCInterfaceDecl *IDecl;
// Gather properties which need not be implemented in this class
// or category.
- if (!(IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl)))
+ if (!IDecl)
if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl)) {
// For categories, no need to implement properties declared in
// its primary class (and its super classes) if property is
@@ -1674,6 +1675,27 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
CollectImmediateProperties(CDecl, PropMap, NoNeedToImplPropMap);
}
+ // Scan the @interface to see if any of the protocols it adopts
+ // require an explicit implementation, via attribute
+ // 'objc_protocol_requires_explicit_implementation'.
+ if (IDecl)
+ for (ObjCInterfaceDecl::all_protocol_iterator
+ PI = IDecl->all_referenced_protocol_begin(),
+ PE = IDecl->all_referenced_protocol_end();
+ PI != PE; ++PI) {
+ ObjCProtocolDecl *PDecl = *PI;
+ if (!PDecl->hasAttr<ObjCExplicitProtocolImplAttr>())
+ continue;
+ // Add the properties of 'PDecl' to the list of properties that
+ // need to be implemented.
+ for (ObjCProtocolDecl::prop_iterator
+ PRI = PDecl->prop_begin(), PRE = PDecl->prop_end();
+ PRI != PRE; ++PRI) {
+ ObjCPropertyDecl *PropDecl = *PRI;
+ PropMap[PRI->getIdentifier()] = PropDecl;
+ }
+ }
+
if (PropMap.empty())
return;