summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
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
commit760a2acbb53da87db38ceb4c6509142c319b541d (patch)
tree9b4a46c4840c4f00610b71cb2d42233cacd20cd7 /clang/lib/Sema/SemaDeclObjC.cpp
parentad807658eacd153ee19caa6d5cbae4fb4e6e064a (diff)
downloadbcm5719-llvm-760a2acbb53da87db38ceb4c6509142c319b541d.tar.gz
bcm5719-llvm-760a2acbb53da87db38ceb4c6509142c319b541d.zip
Fix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementation' conformance.
llvm-svn: 203024
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 57f40aaca54..f71bd56a42b 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud