1// RUN: %clang_cc1 -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s 2// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s 3// rdar://12324295 4 5typedef signed char BOOL; 6 7@protocol P 8@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} expected-note {{method 'ptarget' declared here}} 9@end 10 11@protocol P1<P> 12- (void)setPtarget:(id)arg; 13@end 14 15 16@interface UITableViewCell<P1> 17@property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}} expected-note {{method 'setTarget:' declared here}} 18@end 19 20@interface PSTableCell : UITableViewCell 21 - (void)setTarget:(id)target; 22@end 23 24@interface UITableViewCell(UIDeprecated) 25@property(nonatomic,assign) id dep_target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{method 'dep_target' declared here}} \ 26 // expected-note 4 {{property 'dep_target' is declared deprecated here}} \ 27 // expected-note 2 {{method 'setDep_target:' declared here}} 28@end 29 30@implementation PSTableCell 31- (void)setTarget:(id)target {}; 32- (void)setPtarget:(id)val {}; 33- (void) Meth { 34 [self setTarget: (id)0]; // no-warning 35 [self setDep_target: [self dep_target]]; // expected-warning {{'dep_target' is deprecated: first deprecated in iOS 3.0}} \ 36 // expected-warning {{'setDep_target:' is deprecated: first deprecated in iOS 3.0}} 37 38 [self setPtarget: (id)0]; // no-warning 39} 40@end 41 42@implementation UITableViewCell 43@synthesize target; 44@synthesize ptarget; 45- (void)setPtarget:(id)val {}; 46- (void)setTarget:(id)target {}; 47- (void) Meth { 48 [self setTarget: (id)0]; // expected-warning {{'setTarget:' is deprecated: first deprecated in iOS 3.0}} 49 [self setDep_target: [self dep_target]]; // expected-warning {{'dep_target' is deprecated: first deprecated in iOS 3.0}} \ 50 // expected-warning {{'setDep_target:' is deprecated: first deprecated in iOS 3.0}} 51 52 [self setPtarget: (id)0]; // no-warning 53} 54@end 55 56 57@interface CustomAccessorNames 58@property(getter=isEnabled,assign) BOOL enabled __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'isEnabled' declared here}} expected-note {{property 'enabled' is declared deprecated here}} 59 60@property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'setNewDelegate:' declared here}} expected-note {{property 'delegate' is declared deprecated here}} 61@end 62 63void testCustomAccessorNames(CustomAccessorNames *obj) { 64 if ([obj isEnabled]) // expected-warning {{'isEnabled' is deprecated: first deprecated in iOS 3.0}} 65 [obj setNewDelegate:0]; // expected-warning {{'setNewDelegate:' is deprecated: first deprecated in iOS 3.0}} 66} 67 68 69@interface ProtocolInCategory 70@end 71 72@interface ProtocolInCategory (TheCategory) <P1> 73- (id)ptarget; 74@end 75 76id useDeprecatedProperty(ProtocolInCategory *obj, id<P> obj2, int flag) { 77 if (flag) 78 return [obj ptarget]; // no-warning 79 return [obj2 ptarget]; // expected-warning {{'ptarget' is deprecated: first deprecated in iOS 3.0}} 80} 81