blob: e91cc0aea836e49d89cf10bd2dfa60eafe34f8eb [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s &&
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +00002// RUNX: llvm-gcc -S -emit-llvm -o %t %s &&
3
4// No object generated
5// RUN: grep OBJC_PROTOCOL_P0 %t | count 0 &&
6@protocol P0;
7
8// No object generated
9// RUN: grep OBJC_PROTOCOL_P1 %t | count 0 &&
10@protocol P1 -im1; @end
11
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
16void f0() { id x = @protocol(P2); }
17
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 &&
21@protocol P3;
22void f1() { id x = @protocol(P3); }
23
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 {}; @end
30
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 &&
34@protocol P5;
35void 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
39
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 {}; @end
46void f3() { id x = @protocol(P6); }
47
48// RUN: true