xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/protocols-lazy.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -o %t %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc// No object generated
4*f4a2713aSLionel Sambuc// RUN: not grep OBJC_PROTOCOL_P0 %t
5*f4a2713aSLionel Sambuc@protocol P0;
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc// No object generated
8*f4a2713aSLionel Sambuc// RUN: not grep OBJC_PROTOCOL_P1 %t
9*f4a2713aSLionel Sambuc@protocol P1 -im1; @end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc// Definition triggered by protocol reference.
12*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_P2 %t | count 3
13*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3
14*f4a2713aSLionel Sambuc@protocol P2 -im1; @end
15*f4a2713aSLionel Sambucvoid f0() { id x = @protocol(P2); }
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc// Forward definition triggered by protocol reference.
18*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_P3 %t | count 3
19*f4a2713aSLionel Sambuc// RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t
20*f4a2713aSLionel Sambuc@protocol P3;
21*f4a2713aSLionel Sambucvoid f1() { id x = @protocol(P3); }
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc// Definition triggered by class reference.
24*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_P4 %t | count 3
25*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3
26*f4a2713aSLionel Sambuc@protocol P4 -im1; @end
27*f4a2713aSLionel Sambuc@interface I0<P4> @end
28*f4a2713aSLionel Sambuc@implementation I0 -im1 { return 0; }; @end
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc// Definition following forward reference.
31*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_P5 %t | count 3
32*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3
33*f4a2713aSLionel Sambuc@protocol P5;
34*f4a2713aSLionel Sambucvoid f2() { id x = @protocol(P5); } // This generates a forward
35*f4a2713aSLionel Sambuc                                    // reference, which has to be
36*f4a2713aSLionel Sambuc                                    // updated on the next line.
37*f4a2713aSLionel Sambuc@protocol P5 -im1; @end
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc// Protocol reference following definition.
40*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_P6 %t | count 4
41*f4a2713aSLionel Sambuc// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3
42*f4a2713aSLionel Sambuc@protocol P6 -im1; @end
43*f4a2713aSLionel Sambuc@interface I1<P6> @end
44*f4a2713aSLionel Sambuc@implementation I1 -im1 { return 0; }; @end
45*f4a2713aSLionel Sambucvoid f3() { id x = @protocol(P6); }
46*f4a2713aSLionel Sambuc
47