1 // RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s
2 // RUNX: llvm-gcc -S -emit-llvm -o %t %s &&
5 // RUN: grep OBJC_PROTOCOL_P0 %t | count 0
9 // RUN: grep OBJC_PROTOCOL_P1 %t | count 0
10 @protocol P1 -im1; @end
12 // Definition triggered by protocol reference.
13 // RUN: grep OBJC_PROTOCOL_P2 %t | count 3
14 // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3
15 @protocol P2 -im1; @end
16 void f0() { id x = @protocol(P2); }
18 // Forward definition triggered by protocol reference.
19 // RUN: grep OBJC_PROTOCOL_P3 %t | count 3
20 // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t | count 0
22 void f1() { id x = @protocol(P3); }
24 // Definition triggered by class reference.
25 // RUN: grep OBJC_PROTOCOL_P4 %t | count 3
26 // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3
27 @protocol P4 -im1; @end
28 @interface I0<P4> @end
29 @implementation I0 -im1 { return 0; }; @end
31 // Definition following forward reference.
32 // RUN: grep OBJC_PROTOCOL_P5 %t | count 3
33 // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3
35 void f2() { id x = @protocol(P5); } // This generates a forward
36 // reference, which has to be
37 // updated on the next line.
38 @protocol P5 -im1; @end
40 // Protocol reference following definition.
41 // RUN: grep OBJC_PROTOCOL_P6 %t | count 4
42 // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3
43 @protocol P6 -im1; @end
44 @interface I1<P6> @end
45 @implementation I1 -im1 { return 0; }; @end
46 void f3() { id x = @protocol(P6); }