summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-02-25 18:24:33 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-02-25 18:24:33 +0000
commit8e3b9db27fb1fae13fd326e67d3c88e6f5fc55aa (patch)
treefa1e19620cfbecf5c5e182c797373d8238df4d8b
parent048b6485b753a7a27c09d7d0cc8dd274ff59fe32 (diff)
downloadbcm5719-llvm-8e3b9db27fb1fae13fd326e67d3c88e6f5fc55aa.tar.gz
bcm5719-llvm-8e3b9db27fb1fae13fd326e67d3c88e6f5fc55aa.zip
Forgot to include nested protocols in collection, resulting in
bogus warning. Fixes radar 7682116. llvm-svn: 97157
-rw-r--r--clang/lib/AST/ASTContext.cpp4
-rw-r--r--clang/test/SemaObjC/conditional-expr-7.m30
2 files changed, 33 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 202e3370b67..22871a4a681 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -945,9 +945,11 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
ObjCProtocolDecl *Proto = (*P);
Protocols.insert(Proto);
for (ObjCProtocolDecl::protocol_iterator P = Proto->protocol_begin(),
- PE = Proto->protocol_end(); P != PE; ++P)
+ PE = Proto->protocol_end(); P != PE; ++P) {
+ Protocols.insert(*P);
CollectInheritedProtocols(*P, Protocols);
}
+ }
// Categories of this Interface.
for (const ObjCCategoryDecl *CDeclChain = OI->getCategoryList();
diff --git a/clang/test/SemaObjC/conditional-expr-7.m b/clang/test/SemaObjC/conditional-expr-7.m
new file mode 100644
index 00000000000..3ddf3d73566
--- /dev/null
+++ b/clang/test/SemaObjC/conditional-expr-7.m
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// radar 7682116
+
+@interface Super @end
+
+@interface NSArray : Super @end
+@interface NSSet : Super @end
+
+@protocol MyProtocol
+- (void)myMethod;
+@end
+
+@protocol MyProtocol2 <MyProtocol>
+- (void)myMethod2;
+@end
+
+@interface NSArray() <MyProtocol2>
+@end
+
+@interface NSSet() <MyProtocol>
+@end
+
+int main (int argc, const char * argv[]) {
+ NSArray *array = (void*)0;
+ NSSet *set = (void*)0;
+ id <MyProtocol> instance = (argc) ? array : set;
+ instance = (void*)0;
+ return 0;
+}
+
OpenPOWER on IntegriCloud