John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -o %t %s |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 2 | |
| 3 | // No object generated |
Rafael Espindola | d029cbb | 2013-07-04 15:22:16 +0000 | [diff] [blame] | 4 | // RUN: not grep OBJC_PROTOCOL_P0 %t |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 5 | @protocol P0; |
| 6 | |
| 7 | // No object generated |
Rafael Espindola | d029cbb | 2013-07-04 15:22:16 +0000 | [diff] [blame] | 8 | // RUN: not grep OBJC_PROTOCOL_P1 %t |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 9 | @protocol P1 -im1; @end |
| 10 | |
| 11 | // Definition triggered by protocol reference. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 12 | // RUN: grep OBJC_PROTOCOL_P2 %t | count 3 |
| 13 | // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3 |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 14 | @protocol P2 -im1; @end |
| 15 | void f0() { id x = @protocol(P2); } |
| 16 | |
| 17 | // Forward definition triggered by protocol reference. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 18 | // RUN: grep OBJC_PROTOCOL_P3 %t | count 3 |
Rafael Espindola | d029cbb | 2013-07-04 15:22:16 +0000 | [diff] [blame] | 19 | // RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 20 | @protocol P3; |
| 21 | void f1() { id x = @protocol(P3); } |
| 22 | |
| 23 | // Definition triggered by class reference. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 24 | // RUN: grep OBJC_PROTOCOL_P4 %t | count 3 |
| 25 | // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3 |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 26 | @protocol P4 -im1; @end |
| 27 | @interface I0<P4> @end |
Mike Stump | 6303891 | 2009-07-21 20:50:41 +0000 | [diff] [blame] | 28 | @implementation I0 -im1 { return 0; }; @end |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 29 | |
| 30 | // Definition following forward reference. |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 31 | // RUN: grep OBJC_PROTOCOL_P5 %t | count 3 |
| 32 | // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3 |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 33 | @protocol P5; |
| 34 | void 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 Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 40 | // RUN: grep OBJC_PROTOCOL_P6 %t | count 4 |
| 41 | // RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3 |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 42 | @protocol P6 -im1; @end |
| 43 | @interface I1<P6> @end |
Mike Stump | 6303891 | 2009-07-21 20:50:41 +0000 | [diff] [blame] | 44 | @implementation I1 -im1 { return 0; }; @end |
Daniel Dunbar | 0c0e7a6 | 2008-10-29 22:36:39 +0000 | [diff] [blame] | 45 | void f3() { id x = @protocol(P6); } |
| 46 | |