2012-09-22 04:46:37 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s
|
2015-03-20 03:18:22 +08:00
|
|
|
// RUN: %clang_cc1 -D WARN_PARTIAL -Wpartial-availability -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s
|
2012-09-22 04:46:37 +08:00
|
|
|
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s
|
|
|
|
// rdar://12324295
|
|
|
|
|
2012-10-11 00:42:38 +08:00
|
|
|
typedef signed char BOOL;
|
|
|
|
|
2012-09-22 04:46:37 +08:00
|
|
|
@protocol P
|
2013-12-19 07:30:06 +08:00
|
|
|
@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} expected-note {{'ptarget' has been explicitly marked deprecated here}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-note@+2 {{property 'partialPtarget' is declared partial here}} expected-note@+2 {{'partialPtarget' has been explicitly marked partial here}}
|
|
|
|
#endif
|
|
|
|
@property(nonatomic,assign) id partialPtarget __attribute__((availability(ios,introduced=5.0)));
|
2012-09-22 04:46:37 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol P1<P>
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void)setPtarget:(id)arg;
|
2015-03-20 03:18:22 +08:00
|
|
|
- (void)setPartialPtarget:(id)arg;
|
2012-09-22 04:46:37 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface UITableViewCell<P1>
|
2013-12-19 07:30:06 +08:00
|
|
|
@property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}} expected-note {{'setTarget:' has been explicitly marked deprecated here}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-note@+2 {{property 'partialTarget' is declared partial here}} expected-note@+2 {{'setPartialTarget:' has been explicitly marked partial here}}
|
|
|
|
#endif
|
|
|
|
@property(nonatomic,assign) id partialTarget __attribute__((availability(ios,introduced=5.0)));
|
2012-09-22 04:46:37 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface PSTableCell : UITableViewCell
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void)setTarget:(id)target;
|
2015-03-20 03:18:22 +08:00
|
|
|
- (void)setPartialTarget:(id)target;
|
2012-09-22 04:46:37 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface UITableViewCell(UIDeprecated)
|
2013-12-19 07:30:06 +08:00
|
|
|
@property(nonatomic,assign) id dep_target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{'dep_target' has been explicitly marked deprecated here}} \
|
2013-04-06 08:34:27 +08:00
|
|
|
// expected-note 4 {{property 'dep_target' is declared deprecated here}} \
|
2013-12-19 07:30:06 +08:00
|
|
|
// expected-note 2 {{'setDep_target:' has been explicitly marked deprecated here}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-note@+2 4 {{property 'partial_dep_target' is declared partial here}} expected-note@+2 2 {{'partial_dep_target' has been explicitly marked partial here}} expected-note@+2 2 {{'setPartial_dep_target:' has been explicitly marked partial here}}
|
|
|
|
#endif
|
|
|
|
@property(nonatomic,assign) id partial_dep_target __attribute__((availability(ios,introduced=5.0)));
|
2012-09-22 04:46:37 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation PSTableCell
|
|
|
|
- (void)setTarget:(id)target {};
|
2015-03-20 03:18:22 +08:00
|
|
|
- (void)setPartialTarget:(id)target {};
|
2012-09-22 04:46:37 +08:00
|
|
|
- (void)setPtarget:(id)val {};
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void) Meth {
|
|
|
|
[self setTarget: (id)0]; // no-warning
|
|
|
|
[self setDep_target: [self dep_target]]; // expected-warning {{'dep_target' is deprecated: first deprecated in iOS 3.0}} \
|
|
|
|
// expected-warning {{'setDep_target:' is deprecated: first deprecated in iOS 3.0}}
|
|
|
|
|
|
|
|
[self setPtarget: (id)0]; // no-warning
|
2015-03-20 03:18:22 +08:00
|
|
|
[self setPartialTarget: (id)0]; // no-warning
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-warning@+2 {{'partial_dep_target' is partial: introduced in iOS 5.0}} expected-warning@+2 {{'setPartial_dep_target:' is partial: introduced in iOS 5.0}} expected-note@+2 {{explicitly redeclare 'partial_dep_target' to silence this warning}} expected-note@+2 {{explicitly redeclare 'setPartial_dep_target:' to silence this warning}}
|
|
|
|
#endif
|
|
|
|
[self setPartial_dep_target: [self partial_dep_target]];
|
|
|
|
|
|
|
|
[self setPartialPtarget: (id)0]; // no-warning
|
2013-04-06 08:34:27 +08:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation UITableViewCell
|
|
|
|
@synthesize target;
|
2015-03-20 03:18:22 +08:00
|
|
|
@synthesize partialTarget;
|
2013-04-06 08:34:27 +08:00
|
|
|
@synthesize ptarget;
|
2015-03-20 03:18:22 +08:00
|
|
|
@synthesize partialPtarget;
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void)setPtarget:(id)val {};
|
2015-03-20 03:18:22 +08:00
|
|
|
- (void)setPartialPtarget:(id)val {};
|
2013-04-06 08:34:27 +08:00
|
|
|
- (void)setTarget:(id)target {};
|
2015-03-20 03:18:22 +08:00
|
|
|
- (void)setPartialTarget:(id)target {};
|
2012-09-22 04:46:37 +08:00
|
|
|
- (void) Meth {
|
|
|
|
[self setTarget: (id)0]; // expected-warning {{'setTarget:' is deprecated: first deprecated in iOS 3.0}}
|
|
|
|
[self setDep_target: [self dep_target]]; // expected-warning {{'dep_target' is deprecated: first deprecated in iOS 3.0}} \
|
|
|
|
// expected-warning {{'setDep_target:' is deprecated: first deprecated in iOS 3.0}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
2013-04-06 08:34:27 +08:00
|
|
|
[self setPtarget: (id)0]; // no-warning
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-warning@+2 {{'setPartialTarget:' is partial: introduced in iOS 5.0}} expected-note@+2 {{explicitly redeclare 'setPartialTarget:' to silence this warning}}
|
|
|
|
#endif
|
|
|
|
[self setPartialTarget: (id)0];
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-warning@+2 {{'partial_dep_target' is partial: introduced in iOS 5.0}} expected-warning@+2 {{'setPartial_dep_target:' is partial: introduced in iOS 5.0}} expected-note@+2 {{explicitly redeclare 'partial_dep_target' to silence this warning}} expected-note@+2 {{explicitly redeclare 'setPartial_dep_target:' to silence this warning}}
|
|
|
|
#endif
|
|
|
|
[self setPartial_dep_target: [self partial_dep_target]];
|
|
|
|
[self setPartialPtarget: (id)0]; // no-warning
|
2012-09-22 04:46:37 +08:00
|
|
|
}
|
|
|
|
@end
|
2012-10-11 00:42:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
@interface CustomAccessorNames
|
2013-12-19 07:30:06 +08:00
|
|
|
@property(getter=isEnabled,assign) BOOL enabled __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'isEnabled' has been explicitly marked deprecated here}} expected-note {{property 'enabled' is declared deprecated here}}
|
2012-10-11 00:42:38 +08:00
|
|
|
|
2013-12-19 07:30:06 +08:00
|
|
|
@property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'setNewDelegate:' has been explicitly marked deprecated here}} expected-note {{property 'delegate' is declared deprecated here}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-note@+2 {{property 'partialEnabled' is declared partial here}} expected-note@+2 {{'partialIsEnabled' has been explicitly marked partial here}}
|
|
|
|
#endif
|
|
|
|
@property(getter=partialIsEnabled,assign) BOOL partialEnabled __attribute__((availability(ios,introduced=5.0)));
|
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-note@+2 {{property 'partialDelegate' is declared partial here}} expected-note@+2 {{'partialSetNewDelegate:' has been explicitly marked partial here}}
|
|
|
|
#endif
|
|
|
|
@property(setter=partialSetNewDelegate:,assign) id partialDelegate __attribute__((availability(ios,introduced=5.0)));
|
2012-10-11 00:42:38 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
void testCustomAccessorNames(CustomAccessorNames *obj) {
|
|
|
|
if ([obj isEnabled]) // expected-warning {{'isEnabled' is deprecated: first deprecated in iOS 3.0}}
|
|
|
|
[obj setNewDelegate:0]; // expected-warning {{'setNewDelegate:' is deprecated: first deprecated in iOS 3.0}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-warning@+2 {{'partialIsEnabled' is partial: introduced in iOS 5.0}} expected-warning@+3 {{'partialSetNewDelegate:' is partial: introduced in iOS 5.0}} expected-note@+2 {{explicitly redeclare 'partialIsEnabled' to silence this warning}} expected-note@+3 {{explicitly redeclare 'partialSetNewDelegate:' to silence this warning}}
|
|
|
|
#endif
|
|
|
|
if ([obj partialIsEnabled])
|
|
|
|
[obj partialSetNewDelegate:0];
|
2012-10-11 00:42:38 +08:00
|
|
|
}
|
2012-10-11 00:42:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
@interface ProtocolInCategory
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface ProtocolInCategory (TheCategory) <P1>
|
2013-04-06 08:34:27 +08:00
|
|
|
- (id)ptarget;
|
2015-03-20 03:18:22 +08:00
|
|
|
- (id)partialPtarget;
|
2012-10-11 00:42:54 +08:00
|
|
|
@end
|
|
|
|
|
2013-04-06 08:34:27 +08:00
|
|
|
id useDeprecatedProperty(ProtocolInCategory *obj, id<P> obj2, int flag) {
|
|
|
|
if (flag)
|
|
|
|
return [obj ptarget]; // no-warning
|
|
|
|
return [obj2 ptarget]; // expected-warning {{'ptarget' is deprecated: first deprecated in iOS 3.0}}
|
2015-03-20 03:18:22 +08:00
|
|
|
|
|
|
|
if (flag)
|
|
|
|
return [obj partialPtarget]; // no-warning
|
|
|
|
#if defined(WARN_PARTIAL)
|
|
|
|
// expected-warning@+2 {{'partialPtarget' is partial: introduced in iOS 5.0}} expected-note@+2 {{explicitly redeclare 'partialPtarget' to silence this warning}}
|
|
|
|
#endif
|
|
|
|
return [obj2 partialPtarget];
|
2012-10-11 00:42:54 +08:00
|
|
|
}
|
2014-06-17 01:25:41 +08:00
|
|
|
|
|
|
|
// rdar://15951801
|
|
|
|
@interface Foo
|
|
|
|
{
|
|
|
|
int _x;
|
|
|
|
}
|
|
|
|
@property(nonatomic,readonly) int x;
|
|
|
|
- (void)setX:(int)x __attribute__ ((deprecated)); // expected-note 2 {{'setX:' has been explicitly marked deprecated here}}
|
|
|
|
- (int)x __attribute__ ((unavailable)); // expected-note {{'x' has been explicitly marked unavailable here}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation Foo
|
|
|
|
- (void)setX:(int)x {
|
|
|
|
_x = x;
|
|
|
|
}
|
|
|
|
- (int)x {
|
|
|
|
return _x;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
void testUserAccessorAttributes(Foo *foo) {
|
|
|
|
[foo setX:5678]; // expected-warning {{'setX:' is deprecated}}
|
|
|
|
foo.x = foo.x; // expected-error {{property access is using 'x' method which is unavailable}} \
|
|
|
|
// expected-warning {{property access is using 'setX:' method which is deprecated}}
|
|
|
|
}
|