1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify %s 2 3 @protocol P 4 - (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{'proto_method' has been explicitly marked deprecated here}} 5 @end 6 7 @interface A <P> 8 - (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{'method' has been explicitly marked deprecated here}} 9 10 - (void)overridden __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}} 11 - (void)overridden2 __attribute__((availability(macosx,introduced=10.3))); 12 - (void)overridden3 __attribute__((availability(macosx,deprecated=10.3))); 13 - (void)overridden4 __attribute__((availability(macosx,deprecated=10.3))); // expected-note{{overridden method is here}} 14 - (void)overridden5 __attribute__((availability(macosx,unavailable))); 15 - (void)overridden6 __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}} 16 @end 17 18 // rdar://11475360 19 @interface B : A 20 - (void)method; // NOTE: we expect 'method' to *not* inherit availability. 21 - (void)overridden __attribute__((availability(macosx,introduced=10.4))); // expected-warning{{overriding method introduced after overridden method on OS X (10.4 vs. 10.3)}} 22 - (void)overridden2 __attribute__((availability(macosx,introduced=10.2))); 23 - (void)overridden3 __attribute__((availability(macosx,deprecated=10.4))); 24 - (void)overridden4 __attribute__((availability(macosx,deprecated=10.2))); // expected-warning{{overriding method deprecated before overridden method on OS X (10.3 vs. 10.2)}} 25 - (void)overridden5 __attribute__((availability(macosx,introduced=10.3))); 26 - (void)overridden6 __attribute__((availability(macosx,unavailable))); // expected-warning{{overriding method cannot be unavailable on OS X when its overridden method is available}} 27 @end 28 29 void f(A *a, B *b) { 30 [a method]; // expected-warning{{'method' is deprecated: first deprecated in OS X 10.2}} 31 [b method]; // no-warning 32 [a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}} 33 [b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}} 34 } 35 36 // Test case for <rdar://problem/11627873>. Warn about 37 // using a deprecated method when that method is re-implemented in a 38 // subclass where the redeclared method is not deprecated. 39 @interface C 40 - (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{'method' has been explicitly marked deprecated here}} 41 @end 42 43 @interface D : C 44 - (void) method; 45 @end 46 47 @interface E : D 48 - (void) method; 49 @end 50 51 @implementation D 52 - (void) method { 53 [super method]; // expected-warning {{'method' is deprecated: first deprecated in OS X 10.2}} 54 } 55 @end 56 57 @implementation E 58 - (void) method { 59 [super method]; // no-warning 60 } 61 @end 62 63