Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 2 | |
| 3 | /* This test is for categories which don't implement the accessors but some accessors are |
| 4 | implemented in their base class implementation. In this case,no warning must be issued. |
| 5 | */ |
| 6 | |
| 7 | @interface MyClass |
| 8 | { |
| 9 | int _foo; |
| 10 | } |
| 11 | @property(readonly) int foo; |
| 12 | @end |
| 13 | |
| 14 | @implementation MyClass |
| 15 | - (int) foo { return _foo; } |
| 16 | @end |
| 17 | |
| 18 | @interface MyClass (private) |
| 19 | @property(readwrite) int foo; |
| 20 | @end |
| 21 | |
| 22 | @implementation MyClass (private) |
| 23 | - (void) setFoo:(int)foo { _foo = foo; } |
| 24 | @end |
| 25 | |
| 26 | @interface MyClass (public) |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 27 | @property(readwrite) int foo; // expected-note {{property declared here}} |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 28 | @end |
| 29 | |
Fariborz Jahanian | b860739 | 2011-08-27 21:55:47 +0000 | [diff] [blame] | 30 | @implementation MyClass (public)// expected-warning {{property 'foo' requires method 'setFoo:' to be defined }} |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 31 | @end |