Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
      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)
     27 @property(readwrite)    int        foo;	// expected-note {{property declared here}}
     28 @end
     29 
     30 @implementation MyClass (public)// expected-warning {{property 'foo' requires method 'setFoo:' to be defined }}
     31 @end 
     32 
     33 // rdar://12568064
     34 // No warn of unimplemented property of protocols in category,
     35 // when those properties will be implemented in category's primary
     36 // class or one of its super classes.
     37 @interface HBSuperclass
     38 @property (nonatomic) char myProperty;
     39 @property (nonatomic) char myProperty2;
     40 @end
     41 
     42 @interface HBClass : HBSuperclass
     43 @end
     44 
     45 @protocol HBProtocol
     46 @property (nonatomic) char myProperty;
     47 @property (nonatomic) char myProperty2;
     48 @end
     49 
     50 @interface HBSuperclass (HBSCategory)<HBProtocol>
     51 @end
     52 
     53 @implementation HBSuperclass (HBSCategory)
     54 @end
     55 
     56 @interface HBClass (HBCategory)<HBProtocol>
     57 @end
     58 
     59 @implementation HBClass (HBCategory)
     60 @end
     61