[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / clang / test / ExtractAPI / emit-symbol-graph / multi_file.c
blob651e0df2cd93a09556e7f7db76a2b311ee254ac3
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
5 // RUN: %t/reference.main.json.in >> %t/reference.main.json
6 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
7 // RUN: %t/reference.test.json.in >> %t/reference.test.json
8 // RUN: %clang_cc1 %t/test.c %t/main.c -emit-symbol-graph --pretty-sgf \
9 // RUN: --symbol-graph-dir=%t/SymbolGraphs --product-name=multifile_test -triple=x86_64-apple-macosx12.0.0
11 // Test main.json
12 // Generator version is not consistent across test runs, normalize it.
13 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
14 // RUN: %t/SymbolGraphs/main.c.symbols.json > %t/output-normalized.json
15 // RUN: diff %t/reference.main.json %t/output-normalized.json
17 // Test test.json
18 // Generator version is not consistent across test runs, normalize it.
19 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
20 // RUN: %t/SymbolGraphs/test.c.symbols.json > %t/output-normalized.json
21 // RUN: diff %t/reference.test.json %t/output-normalized.json
23 // CHECK-NOT: error:
24 // CHECK-NOT: warning:
26 //--- test.h
27 #ifndef TEST_H
28 #define TEST_H
30 int testfunc (int param1, int param2);
31 void testfunc2 ();
32 #endif /* TEST_H */
34 //--- test.c
35 #include "test.h"
37 int testfunc(int param1, int param2) { return param1 + param2; }
39 void testfunc2() {}
41 //--- main.c
42 #include "test.h"
44 int main ()
46 testfunc2();
47 return 0;
50 //--- reference.main.json.in
52 "metadata": {
53 "formatVersion": {
54 "major": 0,
55 "minor": 5,
56 "patch": 3
58 "generator": "?"
60 "module": {
61 "name": "multifile_test",
62 "platform": {
63 "architecture": "x86_64",
64 "operatingSystem": {
65 "name": "macosx"
67 "vendor": "apple"
70 "relationships": [],
71 "symbols": [
73 "accessLevel": "public",
74 "declarationFragments": [
76 "kind": "typeIdentifier",
77 "preciseIdentifier": "c:I",
78 "spelling": "int"
81 "kind": "text",
82 "spelling": " "
85 "kind": "identifier",
86 "spelling": "testfunc"
89 "kind": "text",
90 "spelling": "("
93 "kind": "typeIdentifier",
94 "preciseIdentifier": "c:I",
95 "spelling": "int"
98 "kind": "text",
99 "spelling": " "
102 "kind": "internalParam",
103 "spelling": "param1"
106 "kind": "text",
107 "spelling": ", "
110 "kind": "typeIdentifier",
111 "preciseIdentifier": "c:I",
112 "spelling": "int"
115 "kind": "text",
116 "spelling": " "
119 "kind": "internalParam",
120 "spelling": "param2"
123 "kind": "text",
124 "spelling": ");"
127 "functionSignature": {
128 "parameters": [
130 "declarationFragments": [
132 "kind": "typeIdentifier",
133 "preciseIdentifier": "c:I",
134 "spelling": "int"
137 "kind": "text",
138 "spelling": " "
141 "kind": "internalParam",
142 "spelling": "param1"
145 "name": "param1"
148 "declarationFragments": [
150 "kind": "typeIdentifier",
151 "preciseIdentifier": "c:I",
152 "spelling": "int"
155 "kind": "text",
156 "spelling": " "
159 "kind": "internalParam",
160 "spelling": "param2"
163 "name": "param2"
166 "returns": [
168 "kind": "typeIdentifier",
169 "preciseIdentifier": "c:I",
170 "spelling": "int"
174 "identifier": {
175 "interfaceLanguage": "c",
176 "precise": "c:@F@testfunc"
178 "kind": {
179 "displayName": "Function",
180 "identifier": "c.func"
182 "location": {
183 "position": {
184 "character": 4,
185 "line": 3
187 "uri": "file://INPUT_DIR/test.h"
189 "names": {
190 "navigator": [
192 "kind": "identifier",
193 "spelling": "testfunc"
196 "subHeading": [
198 "kind": "identifier",
199 "spelling": "testfunc"
202 "title": "testfunc"
204 "pathComponents": [
205 "testfunc"
209 "accessLevel": "public",
210 "declarationFragments": [
212 "kind": "typeIdentifier",
213 "preciseIdentifier": "c:v",
214 "spelling": "void"
217 "kind": "text",
218 "spelling": " "
221 "kind": "identifier",
222 "spelling": "testfunc2"
225 "kind": "text",
226 "spelling": "();"
229 "functionSignature": {
230 "returns": [
232 "kind": "typeIdentifier",
233 "preciseIdentifier": "c:v",
234 "spelling": "void"
238 "identifier": {
239 "interfaceLanguage": "c",
240 "precise": "c:@F@testfunc2"
242 "kind": {
243 "displayName": "Function",
244 "identifier": "c.func"
246 "location": {
247 "position": {
248 "character": 5,
249 "line": 4
251 "uri": "file://INPUT_DIR/test.h"
253 "names": {
254 "navigator": [
256 "kind": "identifier",
257 "spelling": "testfunc2"
260 "subHeading": [
262 "kind": "identifier",
263 "spelling": "testfunc2"
266 "title": "testfunc2"
268 "pathComponents": [
269 "testfunc2"
273 "accessLevel": "public",
274 "declarationFragments": [
276 "kind": "typeIdentifier",
277 "preciseIdentifier": "c:I",
278 "spelling": "int"
281 "kind": "text",
282 "spelling": " "
285 "kind": "identifier",
286 "spelling": "main"
289 "kind": "text",
290 "spelling": "();"
293 "functionSignature": {
294 "returns": [
296 "kind": "typeIdentifier",
297 "preciseIdentifier": "c:I",
298 "spelling": "int"
302 "identifier": {
303 "interfaceLanguage": "c",
304 "precise": "c:@F@main"
306 "kind": {
307 "displayName": "Function",
308 "identifier": "c.func"
310 "location": {
311 "position": {
312 "character": 4,
313 "line": 2
315 "uri": "file://INPUT_DIR/main.c"
317 "names": {
318 "navigator": [
320 "kind": "identifier",
321 "spelling": "main"
324 "subHeading": [
326 "kind": "identifier",
327 "spelling": "main"
330 "title": "main"
332 "pathComponents": [
333 "main"
338 //--- reference.test.json.in
340 "metadata": {
341 "formatVersion": {
342 "major": 0,
343 "minor": 5,
344 "patch": 3
346 "generator": "?"
348 "module": {
349 "name": "multifile_test",
350 "platform": {
351 "architecture": "x86_64",
352 "operatingSystem": {
353 "name": "macosx"
355 "vendor": "apple"
358 "relationships": [],
359 "symbols": [
361 "accessLevel": "public",
362 "declarationFragments": [
364 "kind": "typeIdentifier",
365 "preciseIdentifier": "c:I",
366 "spelling": "int"
369 "kind": "text",
370 "spelling": " "
373 "kind": "identifier",
374 "spelling": "testfunc"
377 "kind": "text",
378 "spelling": "("
381 "kind": "typeIdentifier",
382 "preciseIdentifier": "c:I",
383 "spelling": "int"
386 "kind": "text",
387 "spelling": " "
390 "kind": "internalParam",
391 "spelling": "param1"
394 "kind": "text",
395 "spelling": ", "
398 "kind": "typeIdentifier",
399 "preciseIdentifier": "c:I",
400 "spelling": "int"
403 "kind": "text",
404 "spelling": " "
407 "kind": "internalParam",
408 "spelling": "param2"
411 "kind": "text",
412 "spelling": ");"
415 "functionSignature": {
416 "parameters": [
418 "declarationFragments": [
420 "kind": "typeIdentifier",
421 "preciseIdentifier": "c:I",
422 "spelling": "int"
425 "kind": "text",
426 "spelling": " "
429 "kind": "internalParam",
430 "spelling": "param1"
433 "name": "param1"
436 "declarationFragments": [
438 "kind": "typeIdentifier",
439 "preciseIdentifier": "c:I",
440 "spelling": "int"
443 "kind": "text",
444 "spelling": " "
447 "kind": "internalParam",
448 "spelling": "param2"
451 "name": "param2"
454 "returns": [
456 "kind": "typeIdentifier",
457 "preciseIdentifier": "c:I",
458 "spelling": "int"
462 "identifier": {
463 "interfaceLanguage": "c",
464 "precise": "c:@F@testfunc"
466 "kind": {
467 "displayName": "Function",
468 "identifier": "c.func"
470 "location": {
471 "position": {
472 "character": 4,
473 "line": 3
475 "uri": "file://INPUT_DIR/test.h"
477 "names": {
478 "navigator": [
480 "kind": "identifier",
481 "spelling": "testfunc"
484 "subHeading": [
486 "kind": "identifier",
487 "spelling": "testfunc"
490 "title": "testfunc"
492 "pathComponents": [
493 "testfunc"
497 "accessLevel": "public",
498 "declarationFragments": [
500 "kind": "typeIdentifier",
501 "preciseIdentifier": "c:v",
502 "spelling": "void"
505 "kind": "text",
506 "spelling": " "
509 "kind": "identifier",
510 "spelling": "testfunc2"
513 "kind": "text",
514 "spelling": "();"
517 "functionSignature": {
518 "returns": [
520 "kind": "typeIdentifier",
521 "preciseIdentifier": "c:v",
522 "spelling": "void"
526 "identifier": {
527 "interfaceLanguage": "c",
528 "precise": "c:@F@testfunc2"
530 "kind": {
531 "displayName": "Function",
532 "identifier": "c.func"
534 "location": {
535 "position": {
536 "character": 5,
537 "line": 4
539 "uri": "file://INPUT_DIR/test.h"
541 "names": {
542 "navigator": [
544 "kind": "identifier",
545 "spelling": "testfunc2"
548 "subHeading": [
550 "kind": "identifier",
551 "spelling": "testfunc2"
554 "title": "testfunc2"
556 "pathComponents": [
557 "testfunc2"