[cfe-commits] r68894 - in /cfe/trunk: 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

Chris Lattner sabre at nondot.org
Sun Apr 12 01:43:26 PDT 2009


Author: lattner
Date: Sun Apr 12 03:43:13 2009
New Revision: 68894

URL: http://llvm.org/viewvc/llvm-project?rev=68894&view=rev
Log:
Fix rdar://6771034: don't warn on use of forward declared protocol in protocol
list of another protocol definition.  This warning is very noisy and GCC doesn't
produce it so existing code doesn't expect it.

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

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Sun Apr 12 03:43:13 2009
@@ -982,7 +982,7 @@
 
   llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs;
   if (Tok.is(tok::less) &&
-      ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
+      ParseObjCProtocolReferences(ProtocolRefs, false, EndProtoLoc))
     return DeclPtrTy();
   
   DeclPtrTy ProtoType =

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sun Apr 12 03:43:13 2009
@@ -503,7 +503,7 @@
   }
 }
 
-/// ActOnForwardProtocolDeclaration - 
+/// ActOnForwardProtocolDeclaration - Handle @protocol foo;
 Action::DeclPtrTy
 Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
                                       const IdentifierLocPair *IdentList,

Modified: cfe/trunk/test/Analysis/region-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/region-1.m?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/region-1.m (original)
+++ cfe/trunk/test/Analysis/region-1.m Sun Apr 12 03:43:13 2009
@@ -19,14 +19,14 @@
 @end  @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;
 @class JabasectItem;
 @protocol EcoClassifier;
- at protocol EcoClassInterfaceCommons <EcoClassifier>    @end  @protocol EcoImplementation;  // expected-warning{{cannot find protocol}}
+ at 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;
- at protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features; // expected-warning 2 {{cannot find protocol}}
+ at protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features; 
 @end @protocol EcoComment;
 @protocol EcoElement <NSObject> - (NSArray *) ownedElements;
 @end @protocol EcoDirectedRelationship;

Modified: cfe/trunk/test/SemaObjC/method-conflict.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-conflict.m?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/method-conflict.m (original)
+++ cfe/trunk/test/SemaObjC/method-conflict.m Sun Apr 12 03:43:13 2009
@@ -25,7 +25,7 @@
 }
   CSSM_FIELDGROUP, *CSSM_FIELDGROUP_PTR;
 @protocol XDUMLClassifier;
- at protocol XDUMLClassInterfaceCommons <XDUMLClassifier>  // expected-warning {{cannot find protocol definition for 'XDUMLClassifier'}}
+ at protocol XDUMLClassInterfaceCommons <XDUMLClassifier> 
 @end  @protocol XDUMLImplementation;
 @protocol XDUMLElement <NSObject> - (NSArray *) ownedElements;
 @end @protocol XDUMLDataType;

Modified: cfe/trunk/test/SemaObjC/protocol-forward-circular.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-forward-circular.m?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-forward-circular.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-forward-circular.m Sun Apr 12 03:43:13 2009
@@ -1,7 +1,7 @@
 // RUN: clang-cc -fsyntax-only -verify %s
 
 @protocol B;
- at protocol C < B > // expected-warning{{cannot find protocol definition for 'B'}} // expected-note{{previous definition is here}}
+ at protocol C < B > // expected-note{{previous definition is here}}
 @end
 @protocol A < C > 
 @end

Modified: cfe/trunk/test/SemaObjC/protocol-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-test-2.m?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-test-2.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-test-2.m Sun Apr 12 03:43:13 2009
@@ -10,7 +10,7 @@
 - (INTF1<p1>*) meth;
 @end
 
- at protocol PROTO2<p1> // expected-warning {{cannot find protocol definition for 'p1'}}
+ at protocol PROTO2<p1>
 @end
 
 @protocol p1 @end
@@ -27,5 +27,12 @@
 @protocol p2 <p1>
 @end
 
- at protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> // expected-warning {{cannot find protocol definition for 'p3'}}
+ at protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> 
+ at end
+
+
+// rdar://6771034
+ at protocol XX;
+ at protocol YY <XX>  // Use of declaration of XX here should not cause a warning.
+- zz;
 @end

Modified: cfe/trunk/test/SemaObjC/protocol-undef.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-undef.m?rev=68894&r1=68893&r2=68894&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-undef.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-undef.m Sun Apr 12 03:43:13 2009
@@ -21,8 +21,8 @@
 - (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).
- at protocol OzzyAnchorP <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
+
+ at protocol OzzyAnchorP <OzzyP>
   @property(nonatomic,retain) id representedObject;
   @property(nonatomic,retain) Ozzy * contentGroup;
 @end





More information about the cfe-commits mailing list