blob: fba7454b95498a3b77be31e0163ec03ad7db7061 [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
3// No object generated
Rafael Espindolad029cbb2013-07-04 15:22:16 +00004// RUN: not grep OBJC_PROTOCOL_P0 %t
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +00005@protocol P0;
6
7// No object generated
Rafael Espindolad029cbb2013-07-04 15:22:16 +00008// RUN: not grep OBJC_PROTOCOL_P1 %t
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +00009@protocol P1 -im1; @end
10
11// Definition triggered by protocol reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000012// RUN: grep OBJC_PROTOCOL_P2 %t | count 3
13// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000014@protocol P2 -im1; @end
15void f0() { id x = @protocol(P2); }
16
17// Forward definition triggered by protocol reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000018// RUN: grep OBJC_PROTOCOL_P3 %t | count 3
Rafael Espindolad029cbb2013-07-04 15:22:16 +000019// RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000020@protocol P3;
21void f1() { id x = @protocol(P3); }
22
23// Definition triggered by class reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000024// RUN: grep OBJC_PROTOCOL_P4 %t | count 3
25// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000026@protocol P4 -im1; @end
27@interface I0<P4> @end
Mike Stump63038912009-07-21 20:50:41 +000028@implementation I0 -im1 { return 0; }; @end
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000029
30// Definition following forward reference.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000031// RUN: grep OBJC_PROTOCOL_P5 %t | count 3
32// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000033@protocol P5;
34void f2() { id x = @protocol(P5); } // This generates a forward
35 // reference, which has to be
36 // updated on the next line.
37@protocol P5 -im1; @end
38
39// Protocol reference following definition.
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000040// RUN: grep OBJC_PROTOCOL_P6 %t | count 4
41// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000042@protocol P6 -im1; @end
43@interface I1<P6> @end
Mike Stump63038912009-07-21 20:50:41 +000044@implementation I1 -im1 { return 0; }; @end
Daniel Dunbar0c0e7a62008-10-29 22:36:39 +000045void f3() { id x = @protocol(P6); }
46