blob: 877d4923f38781f9189d0e097b4376d4909a0084 [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -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
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00005// RUN: grep OBJC_PROTOCOL_P0 %t | count 0
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +00006@protocol P0;
7
8// No object generated
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00009// RUN: grep OBJC_PROTOCOL_P1 %t | count 0
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000010@protocol P1 -im1; @end
11
12// Definition triggered by protocol reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000013// RUN: grep OBJC_PROTOCOL_P2 %t | count 3
14// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000015@protocol P2 -im1; @end
16void f0() { id x = @protocol(P2); }
17
18// Forward definition triggered by protocol reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000019// RUN: grep OBJC_PROTOCOL_P3 %t | count 3
20// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t | count 0
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000021@protocol P3;
22void f1() { id x = @protocol(P3); }
23
24// Definition triggered by class reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000025// RUN: grep OBJC_PROTOCOL_P4 %t | count 3
26// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000027@protocol P4 -im1; @end
28@interface I0<P4> @end
Mike Stump63038912009-07-21 20:50:41 +000029@implementation I0 -im1 { return 0; }; @end
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000030
31// Definition following forward reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000032// RUN: grep OBJC_PROTOCOL_P5 %t | count 3
33// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000034@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.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000041// RUN: grep OBJC_PROTOCOL_P6 %t | count 4
42// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000043@protocol P6 -im1; @end
44@interface I1<P6> @end
Mike Stump63038912009-07-21 20:50:41 +000045@implementation I1 -im1 { return 0; }; @end
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000046void f3() { id x = @protocol(P6); }
47