[cfe-commits] r97157 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaObjC/conditional-expr-7.m

Fariborz Jahanian fjahanian at apple.com
Thu Feb 25 10:24:33 PST 2010


Author: fjahanian
Date: Thu Feb 25 12:24:33 2010
New Revision: 97157

URL: http://llvm.org/viewvc/llvm-project?rev=97157&view=rev
Log:
Forgot to include nested protocols in collection, resulting in
bogus warning. Fixes radar 7682116.

Added:
    cfe/trunk/test/SemaObjC/conditional-expr-7.m
Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=97157&r1=97156&r2=97157&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Feb 25 12:24:33 2010
@@ -945,9 +945,11 @@
       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(); 

Added: cfe/trunk/test/SemaObjC/conditional-expr-7.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/conditional-expr-7.m?rev=97157&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/conditional-expr-7.m (added)
+++ cfe/trunk/test/SemaObjC/conditional-expr-7.m Thu Feb 25 12:24:33 2010
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// radar 7682116
+
+ at interface Super @end
+
+ at interface NSArray : Super @end
+ at interface NSSet : Super @end
+
+ at protocol MyProtocol
+- (void)myMethod;
+ at end
+
+ at protocol MyProtocol2 <MyProtocol>
+- (void)myMethod2;
+ at end
+
+ at interface NSArray() <MyProtocol2>
+ at end
+
+ at interface NSSet() <MyProtocol>
+ at 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;
+}
+





More information about the cfe-commits mailing list