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