xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/warn-deprecated-implementations.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wdeprecated-implementations -verify -Wno-objc-root-class %s
2f4a2713aSLionel Sambuc// rdar://8973810
3f4a2713aSLionel Sambuc// rdar://12717705
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc@protocol P
6f4a2713aSLionel Sambuc- (void) D __attribute__((deprecated)); // expected-note {{method 'D' declared here}}
7f4a2713aSLionel Sambuc@end
8f4a2713aSLionel Sambuc
9f4a2713aSLionel Sambuc@interface A <P>
10f4a2713aSLionel Sambuc+ (void)F __attribute__((deprecated));
11f4a2713aSLionel Sambuc@end
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambuc@interface A()
14*0a6a1f1dSLionel Sambuc- (void) E __attribute__((deprecated));
15f4a2713aSLionel Sambuc@end
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc@implementation A
18f4a2713aSLionel Sambuc+ (void)F { }	// No warning, implementing its own deprecated method
19f4a2713aSLionel Sambuc- (void) D {} //  expected-warning {{Implementing deprecated method}}
20*0a6a1f1dSLionel Sambuc- (void) E {} // No warning, implementing deprecated method in its class extension.
21f4a2713aSLionel Sambuc@end
22f4a2713aSLionel Sambuc
23f4a2713aSLionel Sambuc@interface A(CAT)
24f4a2713aSLionel Sambuc- (void) G __attribute__((deprecated));
25f4a2713aSLionel Sambuc@end
26f4a2713aSLionel Sambuc
27f4a2713aSLionel Sambuc@implementation A(CAT)
28f4a2713aSLionel Sambuc- (void) G {} 	// No warning, implementing its own deprecated method
29f4a2713aSLionel Sambuc@end
30f4a2713aSLionel Sambuc
31f4a2713aSLionel Sambuc__attribute__((deprecated))
32*0a6a1f1dSLionel Sambuc@interface CL // expected-note 2 {{class declared here}} // expected-note 2 {{'CL' has been explicitly marked deprecated here}}
33f4a2713aSLionel Sambuc@end
34f4a2713aSLionel Sambuc
35f4a2713aSLionel Sambuc@implementation CL // expected-warning {{Implementing deprecated class}}
36f4a2713aSLionel Sambuc@end
37f4a2713aSLionel Sambuc
38f4a2713aSLionel Sambuc@implementation CL ( SomeCategory ) // expected-warning {{'CL' is deprecated}} \
39f4a2713aSLionel Sambuc                                    // expected-warning {{Implementing deprecated category}}
40f4a2713aSLionel Sambuc@end
41f4a2713aSLionel Sambuc
42f4a2713aSLionel Sambuc@interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}
43f4a2713aSLionel Sambuc@end
44f4a2713aSLionel Sambuc
45f4a2713aSLionel Sambuc@interface BASE
46f4a2713aSLionel Sambuc- (void) B __attribute__((deprecated)); // expected-note {{method 'B' declared here}}
47f4a2713aSLionel Sambuc@end
48f4a2713aSLionel Sambuc
49f4a2713aSLionel Sambuc@interface SUB : BASE
50f4a2713aSLionel Sambuc@end
51f4a2713aSLionel Sambuc
52f4a2713aSLionel Sambuc@implementation SUB
53f4a2713aSLionel Sambuc- (void) B {} // expected-warning {{Implementing deprecated method}}
54f4a2713aSLionel Sambuc@end
55f4a2713aSLionel Sambuc
56*0a6a1f1dSLionel Sambuc@interface Test
57*0a6a1f1dSLionel Sambuc@end
58*0a6a1f1dSLionel Sambuc
59*0a6a1f1dSLionel Sambuc@interface Test()
60*0a6a1f1dSLionel Sambuc- (id)initSpecialInPrivateHeader __attribute__((deprecated));
61*0a6a1f1dSLionel Sambuc@end
62*0a6a1f1dSLionel Sambuc
63*0a6a1f1dSLionel Sambuc@implementation Test
64*0a6a1f1dSLionel Sambuc- (id)initSpecialInPrivateHeader {
65*0a6a1f1dSLionel Sambuc  return (void *)0;
66*0a6a1f1dSLionel Sambuc}
67*0a6a1f1dSLionel Sambuc@end
68