2011-09-24 04:28:32 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify %s
|
2012-04-24 04:30:52 +08:00
|
|
|
|
|
|
|
@protocol P
|
|
|
|
- (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{method 'proto_method' declared here}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface A <P>
|
|
|
|
- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
|
2013-01-16 06:43:08 +08:00
|
|
|
|
|
|
|
- (void)overridden __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}}
|
|
|
|
- (void)overridden2 __attribute__((availability(macosx,introduced=10.3)));
|
|
|
|
- (void)overridden3 __attribute__((availability(macosx,deprecated=10.3)));
|
|
|
|
- (void)overridden4 __attribute__((availability(macosx,deprecated=10.3))); // expected-note{{overridden method is here}}
|
2013-01-16 08:54:48 +08:00
|
|
|
- (void)overridden5 __attribute__((availability(macosx,unavailable)));
|
|
|
|
- (void)overridden6 __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}}
|
2011-09-24 04:23:42 +08:00
|
|
|
@end
|
|
|
|
|
2012-06-06 05:14:46 +08:00
|
|
|
// rdar://11475360
|
2011-09-24 04:23:42 +08:00
|
|
|
@interface B : A
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void)method; // NOTE: we expect 'method' to *not* inherit availability.
|
2013-01-16 06:43:08 +08:00
|
|
|
- (void)overridden __attribute__((availability(macosx,introduced=10.4))); // expected-warning{{overriding method introduced after overridden method on OS X (10.4 vs. 10.3)}}
|
|
|
|
- (void)overridden2 __attribute__((availability(macosx,introduced=10.2)));
|
|
|
|
- (void)overridden3 __attribute__((availability(macosx,deprecated=10.4)));
|
|
|
|
- (void)overridden4 __attribute__((availability(macosx,deprecated=10.2))); // expected-warning{{overriding method deprecated before overridden method on OS X (10.3 vs. 10.2)}}
|
2013-01-16 08:54:48 +08:00
|
|
|
- (void)overridden5 __attribute__((availability(macosx,introduced=10.3)));
|
|
|
|
- (void)overridden6 __attribute__((availability(macosx,unavailable))); // expected-warning{{overriding method cannot be unavailable on OS X when its overridden method is available}}
|
2011-09-24 04:23:42 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
void f(A *a, B *b) {
|
2012-10-02 02:42:25 +08:00
|
|
|
[a method]; // expected-warning{{'method' is deprecated: first deprecated in OS X 10.2}}
|
2013-04-06 08:34:27 +08:00
|
|
|
[b method]; // no-warning
|
2012-10-02 02:42:25 +08:00
|
|
|
[a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
|
|
|
|
[b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
|
2011-09-24 04:23:42 +08:00
|
|
|
}
|
2013-04-09 07:39:32 +08:00
|
|
|
|
|
|
|
// Test case for <rdar://problem/11627873>. Warn about
|
|
|
|
// using a deprecated method when that method is re-implemented in a
|
|
|
|
// subclass where the redeclared method is not deprecated.
|
|
|
|
@interface C
|
|
|
|
- (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface D : C
|
|
|
|
- (void) method;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface E : D
|
|
|
|
- (void) method;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation D
|
|
|
|
- (void) method {
|
|
|
|
[super method]; // expected-warning {{'method' is deprecated: first deprecated in OS X 10.2}}
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation E
|
|
|
|
- (void) method {
|
|
|
|
[super method]; // no-warning
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|