2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
2009-02-15 03:08:58 +08:00
|
|
|
|
2009-02-17 01:19:12 +08:00
|
|
|
@interface A {
|
|
|
|
int X __attribute__((deprecated));
|
|
|
|
}
|
2009-02-15 03:08:58 +08:00
|
|
|
+ (void)F __attribute__((deprecated));
|
|
|
|
- (void)f __attribute__((deprecated));
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation A
|
|
|
|
+ (void)F __attribute__((deprecated))
|
2011-10-22 09:21:15 +08:00
|
|
|
{
|
2009-02-17 01:08:46 +08:00
|
|
|
[self F]; // no warning, since the caller is also deprecated.
|
2009-02-15 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)g
|
|
|
|
{
|
2009-02-17 01:19:12 +08:00
|
|
|
X++; // expected-warning{{'X' is deprecated}}
|
|
|
|
self->X++; // expected-warning{{'X' is deprecated}}
|
2009-02-15 03:08:58 +08:00
|
|
|
[self f]; // expected-warning{{'f' is deprecated}}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)f
|
|
|
|
{
|
2009-02-17 03:35:30 +08:00
|
|
|
[self f]; // no warning, the caller is deprecated in its interface.
|
2009-02-15 03:08:58 +08:00
|
|
|
}
|
|
|
|
@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));
|
|
|
|
@end
|
|
|
|
|
|
|
|
void t1(A *a)
|
|
|
|
{
|
|
|
|
[A F]; // expected-warning{{'F' is deprecated}}
|
|
|
|
[a f]; // expected-warning{{'f' is deprecated}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void t2(id a)
|
|
|
|
{
|
2011-12-07 08:30:00 +08:00
|
|
|
[a f]; // expected-warning {{'f' is deprecated}}
|
2009-02-15 03:08:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t3(A<P>* a)
|
|
|
|
{
|
|
|
|
[a f]; // expected-warning{{'f' is deprecated}}
|
|
|
|
[a p]; // expected-warning{{'p' is deprecated}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void t4(Class c)
|
|
|
|
{
|
|
|
|
[c F];
|
|
|
|
}
|
|
|
|
|
2009-02-17 02:35:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
@interface Bar
|
|
|
|
|
|
|
|
@property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated));
|
|
|
|
- (void) MySetter : (int) value;
|
|
|
|
@end
|
|
|
|
|
|
|
|
int t5() {
|
|
|
|
Bar *f;
|
|
|
|
f.FooBar = 1; // expected-warning {{warning: 'FooBar' is deprecated}}
|
|
|
|
return f.FooBar; // expected-warning {{warning: 'FooBar' is deprecated}}
|
|
|
|
}
|
|
|
|
|
2009-02-17 05:30:01 +08:00
|
|
|
|
|
|
|
__attribute ((deprecated))
|
|
|
|
@interface DEPRECATED {
|
|
|
|
@public int ivar;
|
2011-10-07 07:23:20 +08:00
|
|
|
DEPRECATED *ivar2; // no warning.
|
2009-02-17 05:30:01 +08:00
|
|
|
}
|
|
|
|
- (int) instancemethod;
|
2011-10-07 07:23:20 +08:00
|
|
|
- (DEPRECATED *) meth; // no warning.
|
2009-02-17 05:30:01 +08:00
|
|
|
@property int prop;
|
|
|
|
@end
|
|
|
|
|
2011-10-07 07:23:27 +08:00
|
|
|
@interface DEPRECATED (Category) // no warning.
|
|
|
|
- (DEPRECATED *) meth2; // no warning.
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface DEPRECATED (Category2) // no warning.
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DEPRECATED (Category2) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
|
2009-02-17 05:30:01 +08:00
|
|
|
@end
|
2009-02-17 05:33:09 +08:00
|
|
|
|
|
|
|
@interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
2010-11-10 15:01:40 +08:00
|
|
|
@interface Test2
|
|
|
|
@property int test2 __attribute__((deprecated));
|
|
|
|
@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}}
|
|
|
|
}
|
2011-09-24 03:19:41 +08:00
|
|
|
|
|
|
|
__attribute__((deprecated))
|
|
|
|
@interface A(Blah) // expected-error{{attributes may not be specified on a category}}
|
|
|
|
@end
|
2011-12-07 08:30:00 +08:00
|
|
|
|
|
|
|
// rdar://10459930
|
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
@interface NSDocumentController
|
|
|
|
{
|
|
|
|
id iv;
|
|
|
|
}
|
|
|
|
- (void)fileExtensionsFromType:(NSString *)typeName __attribute__((deprecated));
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSDocumentController
|
|
|
|
- (void) Meth {
|
|
|
|
[iv fileExtensionsFromType:@"public.text"]; // expected-warning {{'fileExtensionsFromType:' is deprecated}}
|
|
|
|
}
|
|
|
|
- (void)fileExtensionsFromType:(NSString *)typeName {}
|
|
|
|
@end
|