summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-03-05 23:18:22 +0000
committerTed Kremenek <kremenek@apple.com>2014-03-05 23:18:22 +0000
commitd038ebe8f182ed6a54cff3c63747c2cda59dd9f3 (patch)
tree8e443de42f72bd506a75016c13b74d2e76134538 /lib
parentcfdb070d4dd0dcbcbbef854eb025693d5bd99cee (diff)
downloadclang-d038ebe8f182ed6a54cff3c63747c2cda59dd9f3.tar.gz
Fix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementation' conformance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 57f40aaca5..f71bd56a42 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1635,6 +1635,17 @@ void Sema::WarnExactTypedMethods(ObjCMethodDecl *ImpMethodDecl,
typedef llvm::DenseSet<IdentifierInfo*> ProtocolNameSet;
typedef llvm::OwningPtr<ProtocolNameSet> LazyProtocolNameSet;
+
+
+static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl,
+ ProtocolNameSet &PNS) {
+ if (PDecl->hasAttr<ObjCExplicitProtocolImplAttr>())
+ PNS.insert(PDecl->getIdentifier());
+ for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(),
+ PE = PDecl->protocol_end(); PI != PE; ++PI)
+ findProtocolsWithExplicitImpls(*PI, PNS);
+}
+
/// Recursively populates a set with all conformed protocols in a class
/// hierarchy that have the 'objc_protocol_requires_explicit_implementation'
/// attribute.
@@ -1646,10 +1657,10 @@ static void findProtocolsWithExplicitImpls(const ObjCInterfaceDecl *Super,
for (ObjCInterfaceDecl::all_protocol_iterator
I = Super->all_referenced_protocol_begin(),
E = Super->all_referenced_protocol_end(); I != E; ++I) {
- const ObjCProtocolDecl *PDecl = *I;
- if (PDecl->hasAttr<ObjCExplicitProtocolImplAttr>())
- PNS.insert(PDecl->getIdentifier());
+ findProtocolsWithExplicitImpls(*I, PNS);
}
+
+ findProtocolsWithExplicitImpls(Super->getSuperClass(), PNS);
}
/// CheckProtocolMethodDefs - This routine checks unimplemented methods