[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ExtractAPI / underscored.c
blob7a8578a5a7c3b13292a470257c15f75bbfd44938
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 -triple arm64-apple-macosx \
6 // RUN: -x c-header %t/input.h -o %t/output.json -verify
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 //--- input.h
14 // expected-no-diagnostics
16 // Global record
17 int _HiddenGlobal;
18 int exposed_global;
20 // Record type
21 struct _HiddenRecord {
22 int a;
25 struct ExposedRecord {
26 int a;
29 // Typedef
30 typedef struct {} _HiddenTypedef;
31 typedef int ExposedTypedef;
32 typedef _HiddenTypedef ExposedTypedefToHidden;
34 // Macros
35 #define _HIDDEN_MACRO 5
36 #define EXPOSED_MACRO 5
38 // Symbols that start with '_' should not appear in the reference output
39 //--- reference.output.json.in
41 "metadata": {
42 "formatVersion": {
43 "major": 0,
44 "minor": 5,
45 "patch": 3
47 "generator": "?"
49 "module": {
50 "name": "",
51 "platform": {
52 "architecture": "arm64",
53 "operatingSystem": {
54 "minimumVersion": {
55 "major": 11,
56 "minor": 0,
57 "patch": 0
59 "name": "macosx"
61 "vendor": "apple"
64 "relationships": [
66 "kind": "memberOf",
67 "source": "c:@S@ExposedRecord@FI@a",
68 "target": "c:@S@ExposedRecord",
69 "targetFallback": "ExposedRecord"
72 "symbols": [
74 "accessLevel": "public",
75 "declarationFragments": [
77 "kind": "typeIdentifier",
78 "preciseIdentifier": "c:I",
79 "spelling": "int"
82 "kind": "text",
83 "spelling": " "
86 "kind": "identifier",
87 "spelling": "exposed_global"
90 "kind": "text",
91 "spelling": ";"
94 "identifier": {
95 "interfaceLanguage": "c",
96 "precise": "c:@exposed_global"
98 "kind": {
99 "displayName": "Global Variable",
100 "identifier": "c.var"
102 "location": {
103 "position": {
104 "character": 5,
105 "line": 5
107 "uri": "file://INPUT_DIR/input.h"
109 "names": {
110 "navigator": [
112 "kind": "identifier",
113 "spelling": "exposed_global"
116 "subHeading": [
118 "kind": "identifier",
119 "spelling": "exposed_global"
122 "title": "exposed_global"
124 "pathComponents": [
125 "exposed_global"
129 "accessLevel": "public",
130 "declarationFragments": [
132 "kind": "keyword",
133 "spelling": "struct"
136 "kind": "text",
137 "spelling": " "
140 "kind": "identifier",
141 "spelling": "ExposedRecord"
144 "kind": "text",
145 "spelling": ";"
148 "identifier": {
149 "interfaceLanguage": "c",
150 "precise": "c:@S@ExposedRecord"
152 "kind": {
153 "displayName": "Structure",
154 "identifier": "c.struct"
156 "location": {
157 "position": {
158 "character": 8,
159 "line": 12
161 "uri": "file://INPUT_DIR/input.h"
163 "names": {
164 "navigator": [
166 "kind": "identifier",
167 "spelling": "ExposedRecord"
170 "subHeading": [
172 "kind": "identifier",
173 "spelling": "ExposedRecord"
176 "title": "ExposedRecord"
178 "pathComponents": [
179 "ExposedRecord"
183 "accessLevel": "public",
184 "declarationFragments": [
186 "kind": "typeIdentifier",
187 "preciseIdentifier": "c:I",
188 "spelling": "int"
191 "kind": "text",
192 "spelling": " "
195 "kind": "identifier",
196 "spelling": "a"
199 "kind": "text",
200 "spelling": ";"
203 "identifier": {
204 "interfaceLanguage": "c",
205 "precise": "c:@S@ExposedRecord@FI@a"
207 "kind": {
208 "displayName": "Instance Property",
209 "identifier": "c.property"
211 "location": {
212 "position": {
213 "character": 7,
214 "line": 13
216 "uri": "file://INPUT_DIR/input.h"
218 "names": {
219 "navigator": [
221 "kind": "identifier",
222 "spelling": "a"
225 "subHeading": [
227 "kind": "identifier",
228 "spelling": "a"
231 "title": "a"
233 "pathComponents": [
234 "ExposedRecord",
239 "accessLevel": "public",
240 "declarationFragments": [
242 "kind": "keyword",
243 "spelling": "#define"
246 "kind": "text",
247 "spelling": " "
250 "kind": "identifier",
251 "spelling": "EXPOSED_MACRO"
254 "identifier": {
255 "interfaceLanguage": "c",
256 "precise": "c:input.h@335@macro@EXPOSED_MACRO"
258 "kind": {
259 "displayName": "Macro",
260 "identifier": "c.macro"
262 "location": {
263 "position": {
264 "character": 9,
265 "line": 23
267 "uri": "file://INPUT_DIR/input.h"
269 "names": {
270 "navigator": [
272 "kind": "identifier",
273 "spelling": "EXPOSED_MACRO"
276 "subHeading": [
278 "kind": "identifier",
279 "spelling": "EXPOSED_MACRO"
282 "title": "EXPOSED_MACRO"
284 "pathComponents": [
285 "EXPOSED_MACRO"
289 "accessLevel": "public",
290 "declarationFragments": [
292 "kind": "keyword",
293 "spelling": "typedef"
296 "kind": "text",
297 "spelling": " "
300 "kind": "typeIdentifier",
301 "preciseIdentifier": "c:I",
302 "spelling": "int"
305 "kind": "text",
306 "spelling": " "
309 "kind": "identifier",
310 "spelling": "ExposedTypedef"
313 "kind": "text",
314 "spelling": ";"
317 "identifier": {
318 "interfaceLanguage": "c",
319 "precise": "c:input.h@T@ExposedTypedef"
321 "kind": {
322 "displayName": "Type Alias",
323 "identifier": "c.typealias"
325 "location": {
326 "position": {
327 "character": 13,
328 "line": 18
330 "uri": "file://INPUT_DIR/input.h"
332 "names": {
333 "navigator": [
335 "kind": "identifier",
336 "spelling": "ExposedTypedef"
339 "subHeading": [
341 "kind": "identifier",
342 "spelling": "ExposedTypedef"
345 "title": "ExposedTypedef"
347 "pathComponents": [
348 "ExposedTypedef"
350 "type": "c:I"
353 "accessLevel": "public",
354 "declarationFragments": [
356 "kind": "keyword",
357 "spelling": "typedef"
360 "kind": "text",
361 "spelling": " "
364 "kind": "typeIdentifier",
365 "preciseIdentifier": "c:@SA@_HiddenTypedef",
366 "spelling": "_HiddenTypedef"
369 "kind": "text",
370 "spelling": " "
373 "kind": "identifier",
374 "spelling": "ExposedTypedefToHidden"
377 "kind": "text",
378 "spelling": ";"
381 "identifier": {
382 "interfaceLanguage": "c",
383 "precise": "c:input.h@T@ExposedTypedefToHidden"
385 "kind": {
386 "displayName": "Type Alias",
387 "identifier": "c.typealias"
389 "location": {
390 "position": {
391 "character": 24,
392 "line": 19
394 "uri": "file://INPUT_DIR/input.h"
396 "names": {
397 "navigator": [
399 "kind": "identifier",
400 "spelling": "ExposedTypedefToHidden"
403 "subHeading": [
405 "kind": "identifier",
406 "spelling": "ExposedTypedefToHidden"
409 "title": "ExposedTypedefToHidden"
411 "pathComponents": [
412 "ExposedTypedefToHidden"
414 "type": "c:@SA@_HiddenTypedef"