This patch instantiates objects for forward protocols and in general handles use of 
protocols referenced in @protocol declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42191 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/protocol-test-2.m b/test/Sema/protocol-test-2.m
new file mode 100644
index 0000000..04ad3c6
--- /dev/null
+++ b/test/Sema/protocol-test-2.m
@@ -0,0 +1,29 @@
+@interface INTF1 @end
+
+@protocol p1,p2,p3;
+
+@protocol p1;
+
+@protocol PROTO1
+- (INTF1<p1>*) meth;
+@end
+
+@protocol PROTO2<p1> // expected-error {{cannot find protocol definition for 'p1', referenced by 'PROTO2'}}
+@end
+
+@protocol p1 @end
+
+@protocol PROTO<p1>
+@end
+
+@protocol PROTO<p1>	// expected-error {{duplicate protocol declaration of 'PROTO'}}
+@end
+
+@protocol PROTO3<p1, p1>
+@end
+
+@protocol p2 <p1>
+@end
+
+@protocol PROTO4 <p1, p2, PROTO, PROTO3, p3> // expected-error {{cannot find protocol definition for 'p3', referenced by 'PROTO4'}}
+@end