Debian Codegraph @

clang/test/APINotes/availability.m

raw
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fmodules -Wno-private-module -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fapinotes-modules -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify
3
4 #include "HeaderLib.h"
5 #import <SomeKit/SomeKit.h>
6 #import <SomeKit/SomeKit_Private.h>
7
8 int main() {
9 int i;
10 i = unavailable_function(); // expected-error{{'unavailable_function' is unavailable: I beg you not to use this}}
11 // [email protected]:8{{'unavailable_function' has been explicitly marked unavailable here}}
12 i = unavailable_global_int; // expected-error{{'unavailable_global_int' is unavailable}}
13 // [email protected]:9{{'unavailable_global_int' has been explicitly marked unavailable here}}
14
15 unavailable_typedef t; // expected-error{{'unavailable_typedef' is unavailable}}
16 // [email protected]:14{{'unavailable_typedef' has been explicitly marked unavailable here}}
17
18 struct unavailable_struct s; // expected-error{{'unavailable_struct' is unavailable}}
19 // [email protected]:15{{'unavailable_struct' has been explicitly marked unavailable here}}
20
21 B *b = 0; // expected-error{{'B' is unavailable: just don't}}
22 // expected-note@SomeKit/SomeKit.h:15{{'B' has been explicitly marked unavailable here}}
23
24 id<InternalProtocol> proto = 0; // expected-error{{'InternalProtocol' is unavailable: not for you}}
25 // expected-note@SomeKit/SomeKit_Private.h:12{{'InternalProtocol' has been explicitly marked unavailable here}}
26
27 A *a = 0;
28 i = a.intValue; // expected-error{{intValue' is unavailable: wouldn't work anyway}}
29 // expected-note@SomeKit/SomeKit.h:12{{'intValue' has been explicitly marked unavailable here}}
30
31 [a transform:a]; // expected-error{{'transform:' is unavailable: anything but this}}
32 // expected-note@SomeKit/SomeKit.h:6{{'transform:' has been explicitly marked unavailable here}}
33
34 [a implicitGetOnlyInstance]; // expected-error{{'implicitGetOnlyInstance' is unavailable: getter gone}}
35 // expected-note@SomeKit/SomeKit.h:53{{'implicitGetOnlyInstance' has been explicitly marked unavailable here}}
36 [A implicitGetOnlyClass]; // expected-error{{'implicitGetOnlyClass' is unavailable: getter gone}}
37 // expected-note@SomeKit/SomeKit.h:54{{'implicitGetOnlyClass' has been explicitly marked unavailable here}}
38 [a implicitGetSetInstance]; // expected-error{{'implicitGetSetInstance' is unavailable: getter gone}}
39 // expected-note@SomeKit/SomeKit.h:56{{'implicitGetSetInstance' has been explicitly marked unavailable here}}
40 [a setImplicitGetSetInstance: a]; // expected-error{{'setImplicitGetSetInstance:' is unavailable: setter gone}}
41 // expected-note@SomeKit/SomeKit.h:56{{'setImplicitGetSetInstance:' has been explicitly marked unavailable here}}
42 [A implicitGetSetClass]; // expected-error{{'implicitGetSetClass' is unavailable: getter gone}}
43 // expected-note@SomeKit/SomeKit.h:57{{'implicitGetSetClass' has been explicitly marked unavailable here}}
44 [A setImplicitGetSetClass: a]; // expected-error{{'setImplicitGetSetClass:' is unavailable: setter gone}}
45 // expected-note@SomeKit/SomeKit.h:57{{'setImplicitGetSetClass:' has been explicitly marked unavailable here}}
46 return 0;
47 }
48