[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / global_record.c
bloba08d51d21f955657f5eda6d61d9fd3f834a1eed8
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 -extract-api --pretty-sgf --product-name=GlobalRecord -target arm64-apple-macosx \
6 // RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
8 // Generator version is not consistent across test runs, normalize it.
9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
10 // RUN: %t/output.json >> %t/output-normalized.json
11 // RUN: diff %t/reference.output.json %t/output-normalized.json
13 // CHECK-NOT: error:
14 // CHECK-NOT: warning:
16 //--- input.h
17 int num;
19 /**
20 * \brief Add two numbers.
21 * \param [in] x A number.
22 * \param [in] y Another number.
23 * \param [out] res The result of x + y.
25 void add(const int x, const int y, int *res);
27 char unavailable __attribute__((unavailable));
29 //--- reference.output.json.in
31 "metadata": {
32 "formatVersion": {
33 "major": 0,
34 "minor": 5,
35 "patch": 3
37 "generator": "?"
39 "module": {
40 "name": "GlobalRecord",
41 "platform": {
42 "architecture": "arm64",
43 "operatingSystem": {
44 "minimumVersion": {
45 "major": 11,
46 "minor": 0,
47 "patch": 0
49 "name": "macosx"
51 "vendor": "apple"
54 "relationships": [],
55 "symbols": [
57 "accessLevel": "public",
58 "declarationFragments": [
60 "kind": "typeIdentifier",
61 "preciseIdentifier": "c:I",
62 "spelling": "int"
65 "kind": "text",
66 "spelling": " "
69 "kind": "identifier",
70 "spelling": "num"
73 "kind": "text",
74 "spelling": ";"
77 "identifier": {
78 "interfaceLanguage": "c",
79 "precise": "c:@num"
81 "kind": {
82 "displayName": "Global Variable",
83 "identifier": "c.var"
85 "location": {
86 "position": {
87 "character": 4,
88 "line": 0
90 "uri": "file://INPUT_DIR/input.h"
92 "names": {
93 "navigator": [
95 "kind": "identifier",
96 "spelling": "num"
99 "subHeading": [
101 "kind": "identifier",
102 "spelling": "num"
105 "title": "num"
107 "pathComponents": [
108 "num"
112 "accessLevel": "public",
113 "declarationFragments": [
115 "kind": "typeIdentifier",
116 "preciseIdentifier": "c:v",
117 "spelling": "void"
120 "kind": "text",
121 "spelling": " "
124 "kind": "identifier",
125 "spelling": "add"
128 "kind": "text",
129 "spelling": "("
132 "kind": "keyword",
133 "spelling": "const"
136 "kind": "text",
137 "spelling": " "
140 "kind": "typeIdentifier",
141 "preciseIdentifier": "c:I",
142 "spelling": "int"
145 "kind": "text",
146 "spelling": " "
149 "kind": "internalParam",
150 "spelling": "x"
153 "kind": "text",
154 "spelling": ", "
157 "kind": "keyword",
158 "spelling": "const"
161 "kind": "text",
162 "spelling": " "
165 "kind": "typeIdentifier",
166 "preciseIdentifier": "c:I",
167 "spelling": "int"
170 "kind": "text",
171 "spelling": " "
174 "kind": "internalParam",
175 "spelling": "y"
178 "kind": "text",
179 "spelling": ", "
182 "kind": "typeIdentifier",
183 "preciseIdentifier": "c:I",
184 "spelling": "int"
187 "kind": "text",
188 "spelling": " * "
191 "kind": "internalParam",
192 "spelling": "res"
195 "kind": "text",
196 "spelling": ");"
199 "docComment": {
200 "lines": [
202 "range": {
203 "end": {
204 "character": 3,
205 "line": 2
207 "start": {
208 "character": 3,
209 "line": 2
212 "text": ""
215 "range": {
216 "end": {
217 "character": 26,
218 "line": 3
220 "start": {
221 "character": 2,
222 "line": 3
225 "text": " \\brief Add two numbers."
228 "range": {
229 "end": {
230 "character": 29,
231 "line": 4
233 "start": {
234 "character": 2,
235 "line": 4
238 "text": " \\param [in] x A number."
241 "range": {
242 "end": {
243 "character": 35,
244 "line": 5
246 "start": {
247 "character": 2,
248 "line": 5
251 "text": " \\param [in] y Another number."
254 "range": {
255 "end": {
256 "character": 40,
257 "line": 6
259 "start": {
260 "character": 2,
261 "line": 6
264 "text": " \\param [out] res The result of x + y."
267 "range": {
268 "end": {
269 "character": 3,
270 "line": 7
272 "start": {
273 "character": 0,
274 "line": 7
277 "text": " "
281 "functionSignature": {
282 "parameters": [
284 "declarationFragments": [
286 "kind": "keyword",
287 "spelling": "const"
290 "kind": "text",
291 "spelling": " "
294 "kind": "typeIdentifier",
295 "preciseIdentifier": "c:I",
296 "spelling": "int"
299 "kind": "text",
300 "spelling": " "
303 "kind": "internalParam",
304 "spelling": "x"
307 "name": "x"
310 "declarationFragments": [
312 "kind": "keyword",
313 "spelling": "const"
316 "kind": "text",
317 "spelling": " "
320 "kind": "typeIdentifier",
321 "preciseIdentifier": "c:I",
322 "spelling": "int"
325 "kind": "text",
326 "spelling": " "
329 "kind": "internalParam",
330 "spelling": "y"
333 "name": "y"
336 "declarationFragments": [
338 "kind": "typeIdentifier",
339 "preciseIdentifier": "c:I",
340 "spelling": "int"
343 "kind": "text",
344 "spelling": " * "
347 "kind": "internalParam",
348 "spelling": "res"
351 "name": "res"
354 "returns": [
356 "kind": "typeIdentifier",
357 "preciseIdentifier": "c:v",
358 "spelling": "void"
362 "identifier": {
363 "interfaceLanguage": "c",
364 "precise": "c:@F@add"
366 "kind": {
367 "displayName": "Function",
368 "identifier": "c.func"
370 "location": {
371 "position": {
372 "character": 5,
373 "line": 8
375 "uri": "file://INPUT_DIR/input.h"
377 "names": {
378 "navigator": [
380 "kind": "identifier",
381 "spelling": "add"
384 "subHeading": [
386 "kind": "identifier",
387 "spelling": "add"
390 "title": "add"
392 "pathComponents": [
393 "add"