Anders Carlsson | 59843ad | 2009-02-14 19:08:58 +0000 | [diff] [blame] | 1 | // RUN: clang %s -fsyntax-only -verify |
| 2 | |
Chris Lattner | 553905d | 2009-02-16 17:19:12 +0000 | [diff] [blame] | 3 | @interface A { |
| 4 | int X __attribute__((deprecated)); |
| 5 | } |
Anders Carlsson | 59843ad | 2009-02-14 19:08:58 +0000 | [diff] [blame] | 6 | + (void)F __attribute__((deprecated)); |
| 7 | - (void)f __attribute__((deprecated)); |
| 8 | @end |
| 9 | |
| 10 | @implementation A |
| 11 | + (void)F __attribute__((deprecated)) |
| 12 | { |
Chris Lattner | b254ca0 | 2009-02-16 17:08:46 +0000 | [diff] [blame] | 13 | [self F]; // no warning, since the caller is also deprecated. |
Anders Carlsson | 59843ad | 2009-02-14 19:08:58 +0000 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | - (void)g |
| 17 | { |
Chris Lattner | 553905d | 2009-02-16 17:19:12 +0000 | [diff] [blame] | 18 | X++; // expected-warning{{'X' is deprecated}} |
| 19 | self->X++; // expected-warning{{'X' is deprecated}} |
Anders Carlsson | 59843ad | 2009-02-14 19:08:58 +0000 | [diff] [blame] | 20 | [self f]; // expected-warning{{'f' is deprecated}} |
| 21 | } |
| 22 | |
| 23 | - (void)f |
| 24 | { |
Chris Lattner | f15970c | 2009-02-16 19:35:30 +0000 | [diff] [blame] | 25 | [self f]; // no warning, the caller is deprecated in its interface. |
Anders Carlsson | 59843ad | 2009-02-14 19:08:58 +0000 | [diff] [blame] | 26 | } |
| 27 | @end |
| 28 | |
| 29 | @interface B: A |
| 30 | @end |
| 31 | |
| 32 | @implementation B |
| 33 | + (void)G |
| 34 | { |
| 35 | [super F]; // expected-warning{{'F' is deprecated}} |
| 36 | } |
| 37 | |
| 38 | - (void)g |
| 39 | { |
| 40 | [super f]; // // expected-warning{{'f' is deprecated}} |
| 41 | } |
| 42 | @end |
| 43 | |
| 44 | @protocol P |
| 45 | - (void)p __attribute__((deprecated)); |
| 46 | @end |
| 47 | |
| 48 | void t1(A *a) |
| 49 | { |
| 50 | [A F]; // expected-warning{{'F' is deprecated}} |
| 51 | [a f]; // expected-warning{{'f' is deprecated}} |
| 52 | } |
| 53 | |
| 54 | void t2(id a) |
| 55 | { |
| 56 | [a f]; |
| 57 | } |
| 58 | |
| 59 | void t3(A<P>* a) |
| 60 | { |
| 61 | [a f]; // expected-warning{{'f' is deprecated}} |
| 62 | [a p]; // expected-warning{{'p' is deprecated}} |
| 63 | } |
| 64 | |
| 65 | void t4(Class c) |
| 66 | { |
| 67 | [c F]; |
| 68 | } |
| 69 | |
Chris Lattner | 7eba82e | 2009-02-16 18:35:08 +0000 | [diff] [blame] | 70 | |
| 71 | |
| 72 | @interface Bar |
| 73 | |
| 74 | @property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); |
| 75 | - (void) MySetter : (int) value; |
| 76 | @end |
| 77 | |
| 78 | int t5() { |
| 79 | Bar *f; |
| 80 | f.FooBar = 1; // expected-warning {{warning: 'FooBar' is deprecated}} |
| 81 | return f.FooBar; // expected-warning {{warning: 'FooBar' is deprecated}} |
| 82 | } |
| 83 | |
Chris Lattner | 16b34b4 | 2009-02-16 21:30:01 +0000 | [diff] [blame] | 84 | |
| 85 | __attribute ((deprecated)) |
| 86 | @interface DEPRECATED { |
| 87 | @public int ivar; |
| 88 | } |
| 89 | - (int) instancemethod; |
| 90 | @property int prop; |
| 91 | @end |
| 92 | |
| 93 | @interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}} |
| 94 | @end |
Chris Lattner | c7984dd | 2009-02-16 21:33:09 +0000 | [diff] [blame^] | 95 | |
| 96 | @interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}} |
| 97 | @end |
| 98 | |
| 99 | |