[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ExtractAPI / availability.c
blob54dbf5a6cac957cd57065ea6fe2474501fe41f20
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
4 // RUN: %t/reference.output.json.in >> %t/reference.output.json
5 // RUN: %clang_cc1 -extract-api --product-name=Availability -triple arm64-apple-macosx -x c-header %t/input.h -o %t/output.json -verify
7 // Generator version is not consistent across test runs, normalize it.
8 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
9 // RUN: %t/output.json >> %t/output-normalized.json
10 // RUN: diff %t/reference.output.json %t/output-normalized.json
12 // CHECK-NOT: error:
13 // CHECK-NOT: warning:
15 //--- input.h
16 void a(void);
18 void b(void) __attribute__((availability(macos, introduced=12.0)));
20 void c(void) __attribute__((availability(macos, introduced=11.0, deprecated=12.0, obsoleted=20.0)));
22 void d(void) __attribute__((availability(macos, introduced=11.0, deprecated=12.0, obsoleted=20.0))) __attribute__((availability(ios, introduced=13.0)));
24 void e(void) __attribute__((deprecated)) __attribute__((availability(macos, introduced=11.0)));
26 void f(void) __attribute__((unavailable)) __attribute__((availability(macos, introduced=11.0)));
28 void d(void) __attribute__((availability(tvos, introduced=15.0)));
29 ///expected-no-diagnostics
31 //--- reference.output.json.in
33 "metadata": {
34 "formatVersion": {
35 "major": 0,
36 "minor": 5,
37 "patch": 3
39 "generator": "?"
41 "module": {
42 "name": "Availability",
43 "platform": {
44 "architecture": "arm64",
45 "operatingSystem": {
46 "minimumVersion": {
47 "major": 11,
48 "minor": 0,
49 "patch": 0
51 "name": "macosx"
53 "vendor": "apple"
56 "relationships": [],
57 "symbols": [
59 "accessLevel": "public",
60 "declarationFragments": [
62 "kind": "typeIdentifier",
63 "preciseIdentifier": "c:v",
64 "spelling": "void"
67 "kind": "text",
68 "spelling": " "
71 "kind": "identifier",
72 "spelling": "a"
75 "kind": "text",
76 "spelling": "()"
79 "functionSignature": {
80 "returns": [
82 "kind": "typeIdentifier",
83 "preciseIdentifier": "c:v",
84 "spelling": "void"
88 "identifier": {
89 "interfaceLanguage": "c",
90 "precise": "c:@F@a"
92 "kind": {
93 "displayName": "Function",
94 "identifier": "c.func"
96 "location": {
97 "position": {
98 "character": 6,
99 "line": 1
101 "uri": "file://INPUT_DIR/input.h"
103 "names": {
104 "navigator": [
106 "kind": "identifier",
107 "spelling": "a"
110 "subHeading": [
112 "kind": "identifier",
113 "spelling": "a"
116 "title": "a"
118 "pathComponents": [
123 "accessLevel": "public",
124 "availability": [
126 "domain": "macos",
127 "introducedVersion": {
128 "major": 12,
129 "minor": 0,
130 "patch": 0
134 "declarationFragments": [
136 "kind": "typeIdentifier",
137 "preciseIdentifier": "c:v",
138 "spelling": "void"
141 "kind": "text",
142 "spelling": " "
145 "kind": "identifier",
146 "spelling": "b"
149 "kind": "text",
150 "spelling": "()"
153 "functionSignature": {
154 "returns": [
156 "kind": "typeIdentifier",
157 "preciseIdentifier": "c:v",
158 "spelling": "void"
162 "identifier": {
163 "interfaceLanguage": "c",
164 "precise": "c:@F@b"
166 "kind": {
167 "displayName": "Function",
168 "identifier": "c.func"
170 "location": {
171 "position": {
172 "character": 6,
173 "line": 3
175 "uri": "file://INPUT_DIR/input.h"
177 "names": {
178 "navigator": [
180 "kind": "identifier",
181 "spelling": "b"
184 "subHeading": [
186 "kind": "identifier",
187 "spelling": "b"
190 "title": "b"
192 "pathComponents": [
197 "accessLevel": "public",
198 "availability": [
200 "deprecatedVersion": {
201 "major": 12,
202 "minor": 0,
203 "patch": 0
205 "domain": "macos",
206 "introducedVersion": {
207 "major": 11,
208 "minor": 0,
209 "patch": 0
211 "obsoletedVersion": {
212 "major": 20,
213 "minor": 0,
214 "patch": 0
218 "declarationFragments": [
220 "kind": "typeIdentifier",
221 "preciseIdentifier": "c:v",
222 "spelling": "void"
225 "kind": "text",
226 "spelling": " "
229 "kind": "identifier",
230 "spelling": "c"
233 "kind": "text",
234 "spelling": "()"
237 "functionSignature": {
238 "returns": [
240 "kind": "typeIdentifier",
241 "preciseIdentifier": "c:v",
242 "spelling": "void"
246 "identifier": {
247 "interfaceLanguage": "c",
248 "precise": "c:@F@c"
250 "kind": {
251 "displayName": "Function",
252 "identifier": "c.func"
254 "location": {
255 "position": {
256 "character": 6,
257 "line": 5
259 "uri": "file://INPUT_DIR/input.h"
261 "names": {
262 "navigator": [
264 "kind": "identifier",
265 "spelling": "c"
268 "subHeading": [
270 "kind": "identifier",
271 "spelling": "c"
274 "title": "c"
276 "pathComponents": [
281 "accessLevel": "public",
282 "availability": [
284 "deprecatedVersion": {
285 "major": 12,
286 "minor": 0,
287 "patch": 0
289 "domain": "macos",
290 "introducedVersion": {
291 "major": 11,
292 "minor": 0,
293 "patch": 0
295 "obsoletedVersion": {
296 "major": 20,
297 "minor": 0,
298 "patch": 0
302 "domain": "ios",
303 "introducedVersion": {
304 "major": 13,
305 "minor": 0,
306 "patch": 0
310 "domain": "tvos",
311 "introducedVersion": {
312 "major": 15,
313 "minor": 0,
314 "patch": 0
318 "declarationFragments": [
320 "kind": "typeIdentifier",
321 "preciseIdentifier": "c:v",
322 "spelling": "void"
325 "kind": "text",
326 "spelling": " "
329 "kind": "identifier",
330 "spelling": "d"
333 "kind": "text",
334 "spelling": "()"
337 "functionSignature": {
338 "returns": [
340 "kind": "typeIdentifier",
341 "preciseIdentifier": "c:v",
342 "spelling": "void"
346 "identifier": {
347 "interfaceLanguage": "c",
348 "precise": "c:@F@d"
350 "kind": {
351 "displayName": "Function",
352 "identifier": "c.func"
354 "location": {
355 "position": {
356 "character": 6,
357 "line": 7
359 "uri": "file://INPUT_DIR/input.h"
361 "names": {
362 "navigator": [
364 "kind": "identifier",
365 "spelling": "d"
368 "subHeading": [
370 "kind": "identifier",
371 "spelling": "d"
374 "title": "d"
376 "pathComponents": [
381 "accessLevel": "public",
382 "availability": [
384 "domain": "*",
385 "isUnconditionallyDeprecated": true
388 "domain": "macos",
389 "introducedVersion": {
390 "major": 11,
391 "minor": 0,
392 "patch": 0
396 "declarationFragments": [
398 "kind": "typeIdentifier",
399 "preciseIdentifier": "c:v",
400 "spelling": "void"
403 "kind": "text",
404 "spelling": " "
407 "kind": "identifier",
408 "spelling": "e"
411 "kind": "text",
412 "spelling": "()"
415 "functionSignature": {
416 "returns": [
418 "kind": "typeIdentifier",
419 "preciseIdentifier": "c:v",
420 "spelling": "void"
424 "identifier": {
425 "interfaceLanguage": "c",
426 "precise": "c:@F@e"
428 "kind": {
429 "displayName": "Function",
430 "identifier": "c.func"
432 "location": {
433 "position": {
434 "character": 6,
435 "line": 9
437 "uri": "file://INPUT_DIR/input.h"
439 "names": {
440 "navigator": [
442 "kind": "identifier",
443 "spelling": "e"
446 "subHeading": [
448 "kind": "identifier",
449 "spelling": "e"
452 "title": "e"
454 "pathComponents": [