Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ExtractAPI / emit-symbol-graph / single_file.c
blobaa2a5353ae980bcac04367a321ffaa5d1aea5be8
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.output.json.in >> %t/reference.output.json
6 // RUN: %clang_cc1 %t/main.c --emit-symbol-graph=%t/SymbolGraphs --product-name=basicfile -triple=x86_64-apple-macosx12.0.0
8 // Generator version is not consistent across test runs, normalize it.
9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
10 // RUN: %t/SymbolGraphs/main.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 //--- main.c
17 #define TESTMACRO1 2
18 #define TESTMARCRO2 5
20 int main ()
22 return 0;
26 //--- reference.output.json.in
28 "metadata": {
29 "formatVersion": {
30 "major": 0,
31 "minor": 5,
32 "patch": 3
34 "generator": "?"
36 "module": {
37 "name": "basicfile",
38 "platform": {
39 "architecture": "x86_64",
40 "operatingSystem": {
41 "name": "macosx"
43 "vendor": "apple"
46 "relationships": [],
47 "symbols": [
49 "accessLevel": "public",
50 "declarationFragments": [
52 "kind": "typeIdentifier",
53 "preciseIdentifier": "c:I",
54 "spelling": "int"
57 "kind": "text",
58 "spelling": " "
61 "kind": "identifier",
62 "spelling": "main"
65 "kind": "text",
66 "spelling": "();"
69 "functionSignature": {
70 "returns": [
72 "kind": "typeIdentifier",
73 "preciseIdentifier": "c:I",
74 "spelling": "int"
78 "identifier": {
79 "interfaceLanguage": "c",
80 "precise": "c:@F@main"
82 "kind": {
83 "displayName": "Function",
84 "identifier": "c.func"
86 "location": {
87 "position": {
88 "character": 5,
89 "line": 4
91 "uri": "file://INPUT_DIR/main.c"
93 "names": {
94 "navigator": [
96 "kind": "identifier",
97 "spelling": "main"
100 "subHeading": [
102 "kind": "identifier",
103 "spelling": "main"
106 "title": "main"
108 "pathComponents": [
109 "main"
113 "accessLevel": "public",
114 "declarationFragments": [
116 "kind": "keyword",
117 "spelling": "#define"
120 "kind": "text",
121 "spelling": " "
124 "kind": "identifier",
125 "spelling": "TESTMACRO1"
128 "identifier": {
129 "interfaceLanguage": "c",
130 "precise": "c:main.c@8@macro@TESTMACRO1"
132 "kind": {
133 "displayName": "Macro",
134 "identifier": "c.macro"
136 "location": {
137 "position": {
138 "character": 9,
139 "line": 1
141 "uri": "file://INPUT_DIR/main.c"
143 "names": {
144 "navigator": [
146 "kind": "identifier",
147 "spelling": "TESTMACRO1"
150 "subHeading": [
152 "kind": "identifier",
153 "spelling": "TESTMACRO1"
156 "title": "TESTMACRO1"
158 "pathComponents": [
159 "TESTMACRO1"
163 "accessLevel": "public",
164 "declarationFragments": [
166 "kind": "keyword",
167 "spelling": "#define"
170 "kind": "text",
171 "spelling": " "
174 "kind": "identifier",
175 "spelling": "TESTMARCRO2"
178 "identifier": {
179 "interfaceLanguage": "c",
180 "precise": "c:main.c@29@macro@TESTMARCRO2"
182 "kind": {
183 "displayName": "Macro",
184 "identifier": "c.macro"
186 "location": {
187 "position": {
188 "character": 9,
189 "line": 2
191 "uri": "file://INPUT_DIR/main.c"
193 "names": {
194 "navigator": [
196 "kind": "identifier",
197 "spelling": "TESTMARCRO2"
200 "subHeading": [
202 "kind": "identifier",
203 "spelling": "TESTMARCRO2"
206 "title": "TESTMARCRO2"
208 "pathComponents": [
209 "TESTMARCRO2"