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 | f3f0f35 | 2013-04-25 21:59:34 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 3 | |
| 4 | /* This test is for categories which don't implement the accessors but some accessors are |
| 5 | implemented in their base class implementation. In this case,no warning must be issued. |
| 6 | */ |
| 7 | |
| 8 | @interface MyClass |
| 9 | { |
| 10 | int _foo; |
| 11 | } |
| 12 | @property(readonly) int foo; |
| 13 | @end |
| 14 | |
| 15 | @implementation MyClass |
| 16 | - (int) foo { return _foo; } |
| 17 | @end |
| 18 | |
| 19 | @interface MyClass (private) |
| 20 | @property(readwrite) int foo; |
| 21 | @end |
| 22 | |
| 23 | @implementation MyClass (private) |
| 24 | - (void) setFoo:(int)foo { _foo = foo; } |
| 25 | @end |
| 26 | |
| 27 | @interface MyClass (public) |
Fariborz Jahanian | f3f0f35 | 2013-04-25 21:59:34 +0000 | [diff] [blame] | 28 | @property(readwrite) int foo; |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 29 | @end |
| 30 | |
Fariborz Jahanian | f3f0f35 | 2013-04-25 21:59:34 +0000 | [diff] [blame] | 31 | @implementation MyClass (public) |
Fariborz Jahanian | 3ad230e | 2010-01-20 19:36:21 +0000 | [diff] [blame] | 32 | @end |
Fariborz Jahanian | 277076a | 2012-12-19 18:58:55 +0000 | [diff] [blame] | 33 | |
| 34 | // rdar://12568064 |
| 35 | // No warn of unimplemented property of protocols in category, |
| 36 | // when those properties will be implemented in category's primary |
| 37 | // class or one of its super classes. |
| 38 | @interface HBSuperclass |
| 39 | @property (nonatomic) char myProperty; |
| 40 | @property (nonatomic) char myProperty2; |
| 41 | @end |
| 42 | |
| 43 | @interface HBClass : HBSuperclass |
| 44 | @end |
| 45 | |
| 46 | @protocol HBProtocol |
| 47 | @property (nonatomic) char myProperty; |
| 48 | @property (nonatomic) char myProperty2; |
| 49 | @end |
| 50 | |
| 51 | @interface HBSuperclass (HBSCategory)<HBProtocol> |
| 52 | @end |
| 53 | |
| 54 | @implementation HBSuperclass (HBSCategory) |
| 55 | @end |
| 56 | |
| 57 | @interface HBClass (HBCategory)<HBProtocol> |
| 58 | @end |
| 59 | |
| 60 | @implementation HBClass (HBCategory) |
| 61 | @end |