[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / ExtractAPI / global_record_multifile.c
blobffdfbcb7eb8087a7623da867c1a43d18d00d6cd0
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/input1.h %t/input2.h %t/input3.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 //--- input1.h
17 int num;
19 //--- input2.h
20 /**
21 * \brief Add two numbers.
22 * \param [in] x A number.
23 * \param [in] y Another number.
24 * \param [out] res The result of x + y.
26 void add(const int x, const int y, int *res);
28 //--- input3.h
29 char unavailable __attribute__((unavailable));
31 //--- reference.output.json.in
33 "metadata": {
34 "formatVersion": {
35 "major": 0,
36 "minor": 5,
37 "patch": 3
39 "generator": "?"
41 "module": {
42 "name": "GlobalRecord",
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:I",
64 "spelling": "int"
67 "kind": "text",
68 "spelling": " "
71 "kind": "identifier",
72 "spelling": "num"
75 "kind": "text",
76 "spelling": ";"
79 "identifier": {
80 "interfaceLanguage": "c",
81 "precise": "c:@num"
83 "kind": {
84 "displayName": "Global Variable",
85 "identifier": "c.var"
87 "location": {
88 "position": {
89 "character": 4,
90 "line": 0
92 "uri": "file://INPUT_DIR/input1.h"
94 "names": {
95 "navigator": [
97 "kind": "identifier",
98 "spelling": "num"
101 "subHeading": [
103 "kind": "identifier",
104 "spelling": "num"
107 "title": "num"
109 "pathComponents": [
110 "num"
114 "accessLevel": "public",
115 "declarationFragments": [
117 "kind": "typeIdentifier",
118 "preciseIdentifier": "c:v",
119 "spelling": "void"
122 "kind": "text",
123 "spelling": " "
126 "kind": "identifier",
127 "spelling": "add"
130 "kind": "text",
131 "spelling": "("
134 "kind": "keyword",
135 "spelling": "const"
138 "kind": "text",
139 "spelling": " "
142 "kind": "typeIdentifier",
143 "preciseIdentifier": "c:I",
144 "spelling": "int"
147 "kind": "text",
148 "spelling": " "
151 "kind": "internalParam",
152 "spelling": "x"
155 "kind": "text",
156 "spelling": ", "
159 "kind": "keyword",
160 "spelling": "const"
163 "kind": "text",
164 "spelling": " "
167 "kind": "typeIdentifier",
168 "preciseIdentifier": "c:I",
169 "spelling": "int"
172 "kind": "text",
173 "spelling": " "
176 "kind": "internalParam",
177 "spelling": "y"
180 "kind": "text",
181 "spelling": ", "
184 "kind": "typeIdentifier",
185 "preciseIdentifier": "c:I",
186 "spelling": "int"
189 "kind": "text",
190 "spelling": " * "
193 "kind": "internalParam",
194 "spelling": "res"
197 "kind": "text",
198 "spelling": ");"
201 "docComment": {
202 "lines": [
204 "range": {
205 "end": {
206 "character": 3,
207 "line": 0
209 "start": {
210 "character": 3,
211 "line": 0
214 "text": ""
217 "range": {
218 "end": {
219 "character": 26,
220 "line": 1
222 "start": {
223 "character": 2,
224 "line": 1
227 "text": " \\brief Add two numbers."
230 "range": {
231 "end": {
232 "character": 29,
233 "line": 2
235 "start": {
236 "character": 2,
237 "line": 2
240 "text": " \\param [in] x A number."
243 "range": {
244 "end": {
245 "character": 35,
246 "line": 3
248 "start": {
249 "character": 2,
250 "line": 3
253 "text": " \\param [in] y Another number."
256 "range": {
257 "end": {
258 "character": 40,
259 "line": 4
261 "start": {
262 "character": 2,
263 "line": 4
266 "text": " \\param [out] res The result of x + y."
269 "range": {
270 "end": {
271 "character": 3,
272 "line": 5
274 "start": {
275 "character": 0,
276 "line": 5
279 "text": " "
283 "functionSignature": {
284 "parameters": [
286 "declarationFragments": [
288 "kind": "keyword",
289 "spelling": "const"
292 "kind": "text",
293 "spelling": " "
296 "kind": "typeIdentifier",
297 "preciseIdentifier": "c:I",
298 "spelling": "int"
301 "kind": "text",
302 "spelling": " "
305 "kind": "internalParam",
306 "spelling": "x"
309 "name": "x"
312 "declarationFragments": [
314 "kind": "keyword",
315 "spelling": "const"
318 "kind": "text",
319 "spelling": " "
322 "kind": "typeIdentifier",
323 "preciseIdentifier": "c:I",
324 "spelling": "int"
327 "kind": "text",
328 "spelling": " "
331 "kind": "internalParam",
332 "spelling": "y"
335 "name": "y"
338 "declarationFragments": [
340 "kind": "typeIdentifier",
341 "preciseIdentifier": "c:I",
342 "spelling": "int"
345 "kind": "text",
346 "spelling": " * "
349 "kind": "internalParam",
350 "spelling": "res"
353 "name": "res"
356 "returns": [
358 "kind": "typeIdentifier",
359 "preciseIdentifier": "c:v",
360 "spelling": "void"
364 "identifier": {
365 "interfaceLanguage": "c",
366 "precise": "c:@F@add"
368 "kind": {
369 "displayName": "Function",
370 "identifier": "c.func"
372 "location": {
373 "position": {
374 "character": 5,
375 "line": 6
377 "uri": "file://INPUT_DIR/input2.h"
379 "names": {
380 "navigator": [
382 "kind": "identifier",
383 "spelling": "add"
386 "subHeading": [
388 "kind": "identifier",
389 "spelling": "add"
392 "title": "add"
394 "pathComponents": [
395 "add"