// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10.4 -verify -Wno-objc-root-class %s // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10.4 -verify -Wno-objc-root-class %s @interface A { int X __attribute__((deprecated)); // expected-note 2 {{'X' has been explicitly marked deprecated here}} } + (void)F __attribute__((deprecated)); // expected-note 2 {{'F' has been explicitly marked deprecated here}} - (void)f __attribute__((deprecated)); // expected-note 5 {{'f' has been explicitly marked deprecated here}} @end @implementation A + (void)F __attribute__((deprecated)) { [self F]; // no warning, since the caller is also deprecated. } - (void)g { X++; // expected-warning{{'X' is deprecated}} self->X++; // expected-warning{{'X' is deprecated}} [self f]; // expected-warning{{'f' is deprecated}} } - (void)f { [self f]; // no warning, the caller is deprecated in its interface. } @end @interface B: A @end @implementation B + (void)G { [super F]; // expected-warning{{'F' is deprecated}} } - (void)g { [super f]; // // expected-warning{{'f' is deprecated}} } @end @protocol P - (void)p __attribute__((deprecated)); // expected-note {{'p' has been explicitly marked deprecated here}} @end void t1(A *a) { [A F]; // expected-warning{{'F' is deprecated}} [a f]; // expected-warning{{'f' is deprecated}} } void t2(id a) { [a f]; // expected-warning {{'f' is deprecated}} } void t3(A
* a)
{
[a f]; // expected-warning{{'f' is deprecated}}
[a p]; // expected-warning{{'p' is deprecated}}
}
void t4(Class c)
{
[c F];
}
@interface Bar
@property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); // expected-note 2 {{'FooBar' has been explicitly marked deprecated here}}
- (void) MySetter : (int) value;
@end
int t5() {
Bar *f;
f.FooBar = 1; // expected-warning {{'FooBar' is deprecated}}
return f.FooBar; // expected-warning {{'FooBar' is deprecated}}
}
__attribute ((deprecated)) // expected-note {{'DEPRECATED' has been explicitly marked deprecated here}}
@interface DEPRECATED {
@public int ivar;
DEPRECATED *ivar2; // no warning.
}
- (int) instancemethod;
- (DEPRECATED *) meth; // no warning.
@property int prop;
@end
@interface DEPRECATED (Category) // no warning.
- (DEPRECATED *) meth2; // no warning.
@end
@interface DEPRECATED (Category2) // no warning.
- (id)meth;
@end
__attribute__((deprecated))
void depr_function();
@implementation DEPRECATED (Category2) // no warning
- (id)meth {
depr_function(); // no warning.
return 0;
}
@end
@interface NS : DEPRECATED // expected-warning {{'DEPRECATED' is deprecated}}
@end
@interface Test2
@property int test2 __attribute__((deprecated)); // expected-note 2 {{property 'test2' is declared deprecated here}} expected-note 3 {{'test2' has been explicitly marked deprecated here}} \
// expected-note {{'setTest2:' has been explicitly marked deprecated here}}
@end
void test(Test2 *foo) {
int x;
x = foo.test2; // expected-warning {{'test2' is deprecated}}
x = [foo test2]; // expected-warning {{'test2' is deprecated}}
foo.test2 = x; // expected-warning {{'test2' is deprecated}}
[foo setTest2: x]; // expected-warning {{'setTest2:' is deprecated}}
}
__attribute__((deprecated))
@interface A(Blah) // no warning
- (A*)getA;
@end
@implementation A(Blah) // Don't warn by default
- (A*)getA {
return self;
}
@end
typedef struct {
int x;
} footype __attribute((deprecated)); // expected-note 2 {{'footype' has been explicitly marked deprecated here}}
@interface foo {
footype a; // expected-warning {{'footype' is deprecated}}
footype b __attribute((deprecated));
}
@property footype c; // expected-warning {{'footype' is deprecated}}
@property footype d __attribute((deprecated));
@end
// rdar://13569424
@interface NewI
+(void)cmeth;
@end
typedef NewI DeprI __attribute__((deprecated("blah"))); // expected-note 4 {{'DeprI' has been explicitly marked deprecated here}}
@interface SI : DeprI // expected-warning {{'DeprI' is deprecated: blah}}
-(DeprI*)meth; // expected-warning {{'DeprI' is deprecated: blah}}
@end
@implementation SI
-(DeprI*)meth { // expected-warning {{'DeprI' is deprecated: blah}}
[DeprI cmeth]; // expected-warning {{'DeprI' is deprecated: blah}}
return 0;
}
@end
//