aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-12 08:43:13 +0000
committerChris Lattner <sabre@nondot.org>2009-04-12 08:43:13 +0000
commit58fe03bc8083b92b606c31431feb361c45266cc2 (patch)
tree24ca5eff8f856841055217f3c9f8f6d564399337
parentcf70641c289748d8fc9c03e82cbf7c6a52e05e32 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68894 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseObjc.cpp2
-rw-r--r--lib/Sema/SemaDeclObjC.cpp2
-rw-r--r--test/Analysis/region-1.m4
-rw-r--r--test/SemaObjC/method-conflict.m2
-rw-r--r--test/SemaObjC/protocol-forward-circular.m2
-rw-r--r--test/SemaObjC/protocol-test-2.m11
-rw-r--r--test/SemaObjC/protocol-undef.m4
7 files changed, 17 insertions, 10 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 239d35f806..b4f417a15d 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -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 =
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 90a6bee819..49433b5b7b 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -503,7 +503,7 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
}
}
-/// ActOnForwardProtocolDeclaration -
+/// ActOnForwardProtocolDeclaration - Handle @protocol foo;
Action::DeclPtrTy
Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
const IdentifierLocPair *IdentList,
diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m
index f9905079eb..ed172e431e 100644
--- a/test/Analysis/region-1.m
+++ b/test/Analysis/region-1.m
@@ -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;
diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m
index 957cde3c26..1524fbae56 100644
--- a/test/SemaObjC/method-conflict.m
+++ b/test/SemaObjC/method-conflict.m
@@ -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;
diff --git a/test/SemaObjC/protocol-forward-circular.m b/test/SemaObjC/protocol-forward-circular.m
index 40da96e096..804c44f6bf 100644
--- a/test/SemaObjC/protocol-forward-circular.m
+++ b/test/SemaObjC/protocol-forward-circular.m
@@ -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
diff --git a/test/SemaObjC/protocol-test-2.m b/test/SemaObjC/protocol-test-2.m
index 3abb9b5935..265e5d2691 100644
--- a/test/SemaObjC/protocol-test-2.m
+++ b/test/SemaObjC/protocol-test-2.m
@@ -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
@@ -27,5 +27,12 @@
@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
diff --git a/test/SemaObjC/protocol-undef.m b/test/SemaObjC/protocol-undef.m
index 34a33c72f8..6f3350c9e3 100644
--- a/test/SemaObjC/protocol-undef.m
+++ b/test/SemaObjC/protocol-undef.m
@@ -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