Debian Codegraph @

clang/test/SemaObjC/warn-deprecated-implementations.m

raw
1 // RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -fsyntax-only -Wdeprecated-implementations -verify -Wno-objc-root-class %s
2
3 @protocol P
4 - (void) D __attribute__((deprecated)); // expected-note {{method 'D' declared here}}
5
6 - (void) unavailable __attribute__((__unavailable__)); // expected-note {{method 'unavailable' 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
22 - (void) unavailable { } // expected-warning {{implementing unavailable metho}}
23 @end
24
25 @interface A(CAT)
26 - (void) G __attribute__((deprecated));
27 @end
28
29 @implementation A(CAT)
30 - (void) G {} // No warning, implementing its own deprecated method
31 @end
32
33 __attribute__((deprecated)) // expected-note {{'CL' has been explicitly marked deprecated here}}
34 @interface CL // expected-note 2 {{class declared here}}
35 @end
36
37 @implementation CL // expected-warning {{implementing deprecated class}}
38 @end
39
40 @implementation CL (SomeCategory) // expected-warning {{implementing deprecated category}}
41 @end
42
43 @interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}
44 @end
45
46 @interface BASE
47 - (void) B __attribute__((deprecated)); // expected-note {{method 'B' declared here}}
48
49 + (void) unavailable __attribute__((availability(macos, unavailable))); // expected-note {{method 'unavailable' declared here}}
50 @end
51
52 @interface SUB : BASE
53 @end
54
55 @implementation SUB
56 - (void) B {} // expected-warning {{implementing deprecated method}}
57 + (void) unavailable { } // expected-warning {{implementing unavailable method}}
58 @end
59
60 @interface Test
61 @end
62
63 @interface Test()
64 - (id)initSpecialInPrivateHeader __attribute__((deprecated));
65 @end
66
67 @implementation Test
68 - (id)initSpecialInPrivateHeader {
69 return (void *)0;
70 }
71 @end
72
73 __attribute__((deprecated))
74 @interface Test(DeprecatedCategory) // expected-note {{category declared here}}
75 @end
76
77 @implementation Test(DeprecatedCategory) // expected-warning {{implementing deprecated category}}
78 @end