xref: /llvm-project/clang/test/APINotes/availability.m (revision 932949dbb517b089af28fdc480a16a738ee5db78)
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
8int main() {
9  int i;
10  i = unavailable_function(); // expected-error{{'unavailable_function' is unavailable: I beg you not to use this}}
11  // expected-note@HeaderLib.h:8{{'unavailable_function' has been explicitly marked unavailable here}}
12  i = unavailable_global_int; // expected-error{{'unavailable_global_int' is unavailable}}
13  // expected-note@HeaderLib.h:9{{'unavailable_global_int' has been explicitly marked unavailable here}}
14
15  unavailable_typedef t; // expected-error{{'unavailable_typedef' is unavailable}}
16  // expected-note@HeaderLib.h:14{{'unavailable_typedef' has been explicitly marked unavailable here}}
17
18  struct unavailable_struct s; // expected-error{{'unavailable_struct' is unavailable}}
19  // expected-note@HeaderLib.h: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
49