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