]> granicus.if.org Git - clang/commitdiff
Fix rdar://6771034: don't warn on use of forward declared protocol in protocol
authorChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 08:43:13 +0000 (08:43 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 08:43:13 +0000 (08:43 +0000)
list of another protocol definition.  This warning is very noisy and GCC doesn't
produce it so existing code doesn't expect it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68894 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
lib/Sema/SemaDeclObjC.cpp
test/Analysis/region-1.m
test/SemaObjC/method-conflict.m
test/SemaObjC/protocol-forward-circular.m
test/SemaObjC/protocol-test-2.m
test/SemaObjC/protocol-undef.m

index 239d35f80656b12f64365cc5655ba6f40c74e47a..b4f417a15de6e03fe99304170141c440dfaf27e8 100644 (file)
@@ -982,7 +982,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
 
   llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs;
   if (Tok.is(tok::less) &&
-      ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
+      ParseObjCProtocolReferences(ProtocolRefs, false, EndProtoLoc))
     return DeclPtrTy();
   
   DeclPtrTy ProtoType =
index 90a6bee819dd1c21d5708444cae81bc9ac717676..49433b5b7b08d4e4ee8ab5d9c21420f6e9fc7c89 100644 (file)
@@ -503,7 +503,7 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
   }
 }
 
-/// ActOnForwardProtocolDeclaration - 
+/// ActOnForwardProtocolDeclaration - Handle @protocol foo;
 Action::DeclPtrTy
 Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
                                       const IdentifierLocPair *IdentList,
index f9905079eb5c86c0b3d5a00346966447a0228366..ed172e431e994295ccbe00f2cccd8711c5912d38 100644 (file)
@@ -19,14 +19,14 @@ typedef unsigned int NSUInteger;
 @end  @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;
 @class JabasectItem;
 @protocol EcoClassifier;
-@protocol EcoClassInterfaceCommons <EcoClassifier>    @end  @protocol EcoImplementation;  // expected-warning{{cannot find protocol}}
+@protocol EcoClassInterfaceCommons <EcoClassifier>    @end  @protocol EcoImplementation;
 @protocol EcoBehavioredClassifier <EcoClassInterfaceCommons>      - (NSArray *) implementations;
 @end enum {
 CK_UNRESTRICTED= 0,     CK_READ_ONLY,     CK_ADD_ONLY,     CK_REMOVE_ONLY };
 @protocol EcoClass <EcoBehavioredClassifier>      - (NSArray *) ownedAttributes;
 @end @protocol EcoNamespace;
 @protocol EcoType;
-@protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features; // expected-warning 2 {{cannot find protocol}}
+@protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features; 
 @end @protocol EcoComment;
 @protocol EcoElement <NSObject> - (NSArray *) ownedElements;
 @end @protocol EcoDirectedRelationship;
index 957cde3c26c4826dbe193616a9d7e453fa3467e1..1524fbae56c75ee89010ae7af735e29a55a50459 100644 (file)
@@ -25,7 +25,7 @@ typedef struct _NSRange {
 }
   CSSM_FIELDGROUP, *CSSM_FIELDGROUP_PTR;
 @protocol XDUMLClassifier;
-@protocol XDUMLClassInterfaceCommons <XDUMLClassifier>  // expected-warning {{cannot find protocol definition for 'XDUMLClassifier'}}
+@protocol XDUMLClassInterfaceCommons <XDUMLClassifier> 
 @end  @protocol XDUMLImplementation;
 @protocol XDUMLElement <NSObject> - (NSArray *) ownedElements;
 @end @protocol XDUMLDataType;
index 40da96e0961d3ee3a0e19456232aab82a62a4f49..804c44f6bf1bc17a62ea10f81408e789fa4888c0 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: clang-cc -fsyntax-only -verify %s
 
 @protocol B;
-@protocol C < B > // expected-warning{{cannot find protocol definition for 'B'}} // expected-note{{previous definition is here}}
+@protocol C < B > // expected-note{{previous definition is here}}
 @end
 @protocol A < C > 
 @end
index 3abb9b593510392f3278d095b94d600e2e0e196c..265e5d2691fe6c544081acc611ff999c7067b921 100644 (file)
@@ -10,7 +10,7 @@
 - (INTF1<p1>*) meth;
 @end
 
-@protocol PROTO2<p1> // expected-warning {{cannot find protocol definition for 'p1'}}
+@protocol PROTO2<p1>
 @end
 
 @protocol p1 @end
 @protocol p2 <p1>
 @end
 
-@protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> // expected-warning {{cannot find protocol definition for 'p3'}}
+@protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> 
+@end
+
+
+// rdar://6771034
+@protocol XX;
+@protocol YY <XX>  // Use of declaration of XX here should not cause a warning.
+- zz;
 @end
index 34a33c72f833ed90c8c850c0244e75fd211014ed..6f3350c9e3e30d3023270970f13fdebd5d31ea5b 100644 (file)
@@ -21,8 +21,8 @@ typedef NSObject <OzzyAnchorP> OzzyAnchor;
 - (BOOL)anchor:(OzzyAnchor *)anchor confirmRepresentedObject:(id)newObject;
 @end
 typedef NSObject <OzzyAnchorDelegateP> OzzyAnchorDelegate;
-// GCC doesn't warn about the following (which is inconsistent with it's handling of @interface below).
-@protocol OzzyAnchorP <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
+
+@protocol OzzyAnchorP <OzzyP>
   @property(nonatomic,retain) id representedObject;
   @property(nonatomic,retain) Ozzy * contentGroup;
 @end