1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ast-dump=json -ast-dump-filter Test %s | FileCheck %s
12 typedef struct T TestElaboratedType1
;
13 typedef NS::S TestElaboratedType2
;
15 #define CDECL __attribute__((cdecl))
16 typedef void (CDECL
*TestMacroQualifiedType
)();
18 typedef void (T::* TestMemberFunctionPointerType
)();
19 typedef int T::*TestMemberDataPointerType
;
21 typedef int TestQualTypePrinting(const char* c
);
23 typedef int TestUsingShadowDeclType
;
24 namespace TestNamespaceWithUsingShadowType
{
25 using ::TestUsingShadowDeclType
;
28 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
30 // CHECK-NOT: {{^}}Dumping
31 // CHECK: "kind": "TypedefDecl",
32 // CHECK-NEXT: "loc": {
33 // CHECK-NEXT: "offset": {{[0-9]+}},
34 // CHECK-NEXT: "file": "{{.*}}",
35 // CHECK-NEXT: "line": 12,
36 // CHECK-NEXT: "col": 18,
37 // CHECK-NEXT: "tokLen": 19
39 // CHECK-NEXT: "range": {
40 // CHECK-NEXT: "begin": {
41 // CHECK-NEXT: "offset": {{[0-9]+}},
42 // CHECK-NEXT: "col": 1,
43 // CHECK-NEXT: "tokLen": 7
45 // CHECK-NEXT: "end": {
46 // CHECK-NEXT: "offset": {{[0-9]+}},
47 // CHECK-NEXT: "col": 18,
48 // CHECK-NEXT: "tokLen": 19
51 // CHECK-NEXT: "name": "TestElaboratedType1",
52 // CHECK-NEXT: "type": {
53 // CHECK-NEXT: "desugaredQualType": "T",
54 // CHECK-NEXT: "qualType": "struct T"
56 // CHECK-NEXT: "inner": [
58 // CHECK-NEXT: "id": "0x{{.*}}",
59 // CHECK-NEXT: "kind": "ElaboratedType",
60 // CHECK-NEXT: "type": {
61 // CHECK-NEXT: "qualType": "struct T"
63 // CHECK-NEXT: "inner": [
65 // CHECK-NEXT: "id": "0x{{.*}}",
66 // CHECK-NEXT: "kind": "RecordType",
67 // CHECK-NEXT: "type": {
68 // CHECK-NEXT: "qualType": "T"
70 // CHECK-NEXT: "decl": {
71 // CHECK-NEXT: "id": "0x{{.*}}",
72 // CHECK-NEXT: "kind": "CXXRecordDecl",
73 // CHECK-NEXT: "name": "T"
81 // CHECK-NOT: {{^}}Dumping
82 // CHECK: "kind": "TypedefDecl",
83 // CHECK-NEXT: "loc": {
84 // CHECK-NEXT: "offset": {{[0-9]+}},
85 // CHECK-NEXT: "file": "{{.*}}",
86 // CHECK-NEXT: "line": 13,
87 // CHECK-NEXT: "col": 15,
88 // CHECK-NEXT: "tokLen": 19
90 // CHECK-NEXT: "range": {
91 // CHECK-NEXT: "begin": {
92 // CHECK-NEXT: "offset": {{[0-9]+}},
93 // CHECK-NEXT: "col": 1,
94 // CHECK-NEXT: "tokLen": 7
96 // CHECK-NEXT: "end": {
97 // CHECK-NEXT: "offset": {{[0-9]+}},
98 // CHECK-NEXT: "col": 15,
99 // CHECK-NEXT: "tokLen": 19
102 // CHECK-NEXT: "name": "TestElaboratedType2",
103 // CHECK-NEXT: "type": {
104 // CHECK-NEXT: "qualType": "NS::S"
106 // CHECK-NEXT: "inner": [
108 // CHECK-NEXT: "id": "0x{{.*}}",
109 // CHECK-NEXT: "kind": "ElaboratedType",
110 // CHECK-NEXT: "type": {
111 // CHECK-NEXT: "qualType": "NS::S"
113 // CHECK-NEXT: "qualifier": "NS::",
114 // CHECK-NEXT: "inner": [
116 // CHECK-NEXT: "id": "0x{{.*}}",
117 // CHECK-NEXT: "kind": "RecordType",
118 // CHECK-NEXT: "type": {
119 // CHECK-NEXT: "qualType": "NS::S"
121 // CHECK-NEXT: "decl": {
122 // CHECK-NEXT: "id": "0x{{.*}}",
123 // CHECK-NEXT: "kind": "CXXRecordDecl",
124 // CHECK-NEXT: "name": "S"
132 // CHECK-NOT: {{^}}Dumping
133 // CHECK: "kind": "TypedefDecl",
134 // CHECK-NEXT: "loc": {
135 // CHECK-NEXT: "offset": {{[0-9]+}},
136 // CHECK-NEXT: "file": "{{.*}}",
137 // CHECK-NEXT: "line": 16,
138 // CHECK-NEXT: "col": 22,
139 // CHECK-NEXT: "tokLen": 22
141 // CHECK-NEXT: "range": {
142 // CHECK-NEXT: "begin": {
143 // CHECK-NEXT: "offset": {{[0-9]+}},
144 // CHECK-NEXT: "col": 1,
145 // CHECK-NEXT: "tokLen": 7
147 // CHECK-NEXT: "end": {
148 // CHECK-NEXT: "offset": {{[0-9]+}},
149 // CHECK-NEXT: "col": 22,
150 // CHECK-NEXT: "tokLen": 22
153 // CHECK-NEXT: "name": "TestMacroQualifiedType",
154 // CHECK-NEXT: "type": {
155 // CHECK-NEXT: "qualType": "CDECL void (*)()"
157 // CHECK-NEXT: "inner": [
159 // CHECK-NEXT: "id": "0x{{.*}}",
160 // CHECK-NEXT: "kind": "PointerType",
161 // CHECK-NEXT: "type": {
162 // CHECK-NEXT: "qualType": "CDECL void (*)()"
164 // CHECK-NEXT: "inner": [
166 // CHECK-NEXT: "id": "0x{{.*}}",
167 // CHECK-NEXT: "kind": "MacroQualifiedType",
168 // CHECK-NEXT: "type": {
169 // CHECK-NEXT: "qualType": "CDECL void ()"
171 // CHECK-NEXT: "macroName": "CDECL",
172 // CHECK-NEXT: "inner": [
174 // CHECK-NEXT: "id": "0x{{.*}}",
175 // CHECK-NEXT: "kind": "AttributedType",
176 // CHECK-NEXT: "type": {
177 // CHECK-NEXT: "qualType": "void () __attribute__((cdecl))"
179 // CHECK-NEXT: "inner": [
181 // CHECK-NEXT: "id": "0x{{.*}}",
182 // CHECK-NEXT: "kind": "ParenType",
183 // CHECK-NEXT: "type": {
184 // CHECK-NEXT: "qualType": "void ()"
186 // CHECK-NEXT: "inner": [
188 // CHECK-NEXT: "id": "0x{{.*}}",
189 // CHECK-NEXT: "kind": "FunctionProtoType",
190 // CHECK-NEXT: "type": {
191 // CHECK-NEXT: "qualType": "void ()"
193 // CHECK-NEXT: "cc": "cdecl",
194 // CHECK-NEXT: "inner": [
196 // CHECK-NEXT: "id": "0x{{.*}}",
197 // CHECK-NEXT: "kind": "BuiltinType",
198 // CHECK-NEXT: "type": {
199 // CHECK-NEXT: "qualType": "void"
215 // CHECK-NOT: {{^}}Dumping
216 // CHECK: "kind": "TypedefDecl",
217 // CHECK-NEXT: "loc": {
218 // CHECK-NEXT: "offset": {{[0-9]+}},
219 // CHECK-NEXT: "file": "{{.*}}",
220 // CHECK-NEXT: "line": 18,
221 // CHECK-NEXT: "col": 20,
222 // CHECK-NEXT: "tokLen": 29
224 // CHECK-NEXT: "range": {
225 // CHECK-NEXT: "begin": {
226 // CHECK-NEXT: "offset": {{[0-9]+}},
227 // CHECK-NEXT: "col": 1,
228 // CHECK-NEXT: "tokLen": 7
230 // CHECK-NEXT: "end": {
231 // CHECK-NEXT: "offset": {{[0-9]+}},
232 // CHECK-NEXT: "col": 51,
233 // CHECK-NEXT: "tokLen": 1
236 // CHECK-NEXT: "name": "TestMemberFunctionPointerType",
237 // CHECK-NEXT: "type": {
238 // CHECK-NEXT: "qualType": "void (T::*)()"
240 // CHECK-NEXT: "inner": [
242 // CHECK-NEXT: "id": "0x{{.*}}",
243 // CHECK-NEXT: "kind": "MemberPointerType",
244 // CHECK-NEXT: "type": {
245 // CHECK-NEXT: "qualType": "void (T::*)()"
247 // CHECK-NEXT: "isFunction": true,
248 // CHECK-NEXT: "inner": [
250 // CHECK-NEXT: "id": "0x{{.*}}",
251 // CHECK-NEXT: "kind": "RecordType",
252 // CHECK-NEXT: "type": {
253 // CHECK-NEXT: "qualType": "T"
255 // CHECK-NEXT: "decl": {
256 // CHECK-NEXT: "id": "0x{{.*}}",
257 // CHECK-NEXT: "kind": "CXXRecordDecl",
258 // CHECK-NEXT: "name": "T"
262 // CHECK-NEXT: "id": "0x{{.*}}",
263 // CHECK-NEXT: "kind": "ParenType",
264 // CHECK-NEXT: "type": {
265 // CHECK-NEXT: "qualType": "void ()"
267 // CHECK-NEXT: "inner": [
269 // CHECK-NEXT: "id": "0x{{.*}}",
270 // CHECK-NEXT: "kind": "FunctionProtoType",
271 // CHECK-NEXT: "type": {
272 // CHECK-NEXT: "qualType": "void ()"
274 // CHECK-NEXT: "cc": "cdecl",
275 // CHECK-NEXT: "inner": [
277 // CHECK-NEXT: "id": "0x{{.*}}",
278 // CHECK-NEXT: "kind": "BuiltinType",
279 // CHECK-NEXT: "type": {
280 // CHECK-NEXT: "qualType": "void"
292 // CHECK-NOT: {{^}}Dumping
293 // CHECK: "kind": "TypedefDecl",
294 // CHECK-NEXT: "loc": {
295 // CHECK-NEXT: "offset": {{[0-9]+}},
296 // CHECK-NEXT: "file": "{{.*}}",
297 // CHECK-NEXT: "line": 19,
298 // CHECK-NEXT: "col": 17,
299 // CHECK-NEXT: "tokLen": 25
301 // CHECK-NEXT: "range": {
302 // CHECK-NEXT: "begin": {
303 // CHECK-NEXT: "offset": {{[0-9]+}},
304 // CHECK-NEXT: "col": 1,
305 // CHECK-NEXT: "tokLen": 7
307 // CHECK-NEXT: "end": {
308 // CHECK-NEXT: "offset": {{[0-9]+}},
309 // CHECK-NEXT: "col": 17,
310 // CHECK-NEXT: "tokLen": 25
313 // CHECK-NEXT: "name": "TestMemberDataPointerType",
314 // CHECK-NEXT: "type": {
315 // CHECK-NEXT: "qualType": "int T::*"
317 // CHECK-NEXT: "inner": [
319 // CHECK-NEXT: "id": "0x{{.*}}",
320 // CHECK-NEXT: "kind": "MemberPointerType",
321 // CHECK-NEXT: "type": {
322 // CHECK-NEXT: "qualType": "int T::*"
324 // CHECK-NEXT: "isData": true,
325 // CHECK-NEXT: "inner": [
327 // CHECK-NEXT: "id": "0x{{.*}}",
328 // CHECK-NEXT: "kind": "RecordType",
329 // CHECK-NEXT: "type": {
330 // CHECK-NEXT: "qualType": "T"
332 // CHECK-NEXT: "decl": {
333 // CHECK-NEXT: "id": "0x{{.*}}",
334 // CHECK-NEXT: "kind": "CXXRecordDecl",
335 // CHECK-NEXT: "name": "T"
339 // CHECK-NEXT: "id": "0x{{.*}}",
340 // CHECK-NEXT: "kind": "BuiltinType",
341 // CHECK-NEXT: "type": {
342 // CHECK-NEXT: "qualType": "int"
350 // CHECK-NOT: {{^}}Dumping
351 // CHECK: "kind": "TypedefDecl",
352 // CHECK-NEXT: "loc": {
353 // CHECK-NEXT: "offset": {{[0-9]+}},
354 // CHECK-NEXT: "file": "{{.*}}",
355 // CHECK-NEXT: "line": 21,
356 // CHECK-NEXT: "col": 13,
357 // CHECK-NEXT: "tokLen": 20
359 // CHECK-NEXT: "range": {
360 // CHECK-NEXT: "begin": {
361 // CHECK-NEXT: "offset": {{[0-9]+}},
362 // CHECK-NEXT: "col": 1,
363 // CHECK-NEXT: "tokLen": 7
365 // CHECK-NEXT: "end": {
366 // CHECK-NEXT: "offset": {{[0-9]+}},
367 // CHECK-NEXT: "col": 47,
368 // CHECK-NEXT: "tokLen": 1
371 // CHECK-NEXT: "name": "TestQualTypePrinting",
372 // CHECK-NEXT: "type": {
373 // CHECK-NEXT: "qualType": "int (const char *)"
375 // CHECK-NEXT: "inner": [
377 // CHECK-NEXT: "id": "0x{{.*}}",
378 // CHECK-NEXT: "kind": "FunctionProtoType",
379 // CHECK-NEXT: "type": {
380 // CHECK-NEXT: "qualType": "int (const char *)"
382 // CHECK-NEXT: "cc": "cdecl",
383 // CHECK-NEXT: "inner": [
385 // CHECK-NEXT: "id": "0x{{.*}}",
386 // CHECK-NEXT: "kind": "BuiltinType",
387 // CHECK-NEXT: "type": {
388 // CHECK-NEXT: "qualType": "int"
392 // CHECK-NEXT: "id": "0x{{.*}}",
393 // CHECK-NEXT: "kind": "PointerType",
394 // CHECK-NEXT: "type": {
395 // CHECK-NEXT: "qualType": "const char *"
397 // CHECK-NEXT: "inner": [
399 // CHECK-NEXT: "id": "0x{{.*}}",
400 // CHECK-NEXT: "kind": "QualType",
401 // CHECK-NEXT: "type": {
402 // CHECK-NEXT: "qualType": "const char"
404 // CHECK-NEXT: "qualifiers": "const",
405 // CHECK-NEXT: "inner": [
407 // CHECK-NEXT: "id": "0x{{.*}}",
408 // CHECK-NEXT: "kind": "BuiltinType",
409 // CHECK-NEXT: "type": {
410 // CHECK-NEXT: "qualType": "char"
422 // CHECK-NOT: {{^}}Dumping
423 // CHECK: "kind": "TypedefDecl",
424 // CHECK-NEXT: "loc": {
425 // CHECK-NEXT: "offset": {{[0-9]+}},
426 // CHECK-NEXT: "file": "{{.*}}",
427 // CHECK-NEXT: "line": 23,
428 // CHECK-NEXT: "col": 13,
429 // CHECK-NEXT: "tokLen": 23
431 // CHECK-NEXT: "range": {
432 // CHECK-NEXT: "begin": {
433 // CHECK-NEXT: "offset": {{[0-9]+}},
434 // CHECK-NEXT: "col": 1,
435 // CHECK-NEXT: "tokLen": 7
437 // CHECK-NEXT: "end": {
438 // CHECK-NEXT: "offset": {{[0-9]+}},
439 // CHECK-NEXT: "col": 13,
440 // CHECK-NEXT: "tokLen": 23
443 // CHECK-NEXT: "name": "TestUsingShadowDeclType",
444 // CHECK-NEXT: "type": {
445 // CHECK-NEXT: "qualType": "int"
447 // CHECK-NEXT: "inner": [
449 // CHECK-NEXT: "id": "0x{{.*}}",
450 // CHECK-NEXT: "kind": "BuiltinType",
451 // CHECK-NEXT: "type": {
452 // CHECK-NEXT: "qualType": "int"
458 // CHECK-NOT: {{^}}Dumping
459 // CHECK: "kind": "NamespaceDecl",
460 // CHECK-NEXT: "loc": {
461 // CHECK-NEXT: "offset": {{[0-9]+}},
462 // CHECK-NEXT: "file": "{{.*}}",
463 // CHECK-NEXT: "line": 24,
464 // CHECK-NEXT: "col": 11,
465 // CHECK-NEXT: "tokLen": 32
467 // CHECK-NEXT: "range": {
468 // CHECK-NEXT: "begin": {
469 // CHECK-NEXT: "offset": {{[0-9]+}},
470 // CHECK-NEXT: "col": 1,
471 // CHECK-NEXT: "tokLen": 9
473 // CHECK-NEXT: "end": {
474 // CHECK-NEXT: "offset": {{[0-9]+}},
475 // CHECK-NEXT: "line": 26,
476 // CHECK-NEXT: "col": 1,
477 // CHECK-NEXT: "tokLen": 1
480 // CHECK-NEXT: "name": "TestNamespaceWithUsingShadowType",
481 // CHECK-NEXT: "inner": [
483 // CHECK-NEXT: "id": "0x{{.*}}",
484 // CHECK-NEXT: "kind": "UsingDecl",
485 // CHECK-NEXT: "loc": {
486 // CHECK-NEXT: "offset": {{[0-9]+}},
487 // CHECK-NEXT: "line": 25,
488 // CHECK-NEXT: "col": 9,
489 // CHECK-NEXT: "tokLen": 23
491 // CHECK-NEXT: "range": {
492 // CHECK-NEXT: "begin": {
493 // CHECK-NEXT: "offset": {{[0-9]+}},
494 // CHECK-NEXT: "col": 1,
495 // CHECK-NEXT: "tokLen": 5
497 // CHECK-NEXT: "end": {
498 // CHECK-NEXT: "offset": {{[0-9]+}},
499 // CHECK-NEXT: "col": 9,
500 // CHECK-NEXT: "tokLen": 23
503 // CHECK-NEXT: "name": "::TestUsingShadowDeclType"
506 // CHECK-NEXT: "id": "0x{{.*}}",
507 // CHECK-NEXT: "kind": "UsingShadowDecl",
508 // CHECK-NEXT: "loc": {
509 // CHECK-NEXT: "offset": {{[0-9]+}},
510 // CHECK-NEXT: "col": 9,
511 // CHECK-NEXT: "tokLen": 23
513 // CHECK-NEXT: "range": {
514 // CHECK-NEXT: "begin": {
515 // CHECK-NEXT: "offset": {{[0-9]+}},
516 // CHECK-NEXT: "col": 9,
517 // CHECK-NEXT: "tokLen": 23
519 // CHECK-NEXT: "end": {
520 // CHECK-NEXT: "offset": {{[0-9]+}},
521 // CHECK-NEXT: "col": 9,
522 // CHECK-NEXT: "tokLen": 23
525 // CHECK-NEXT: "isImplicit": true,
526 // CHECK-NEXT: "target": {
527 // CHECK-NEXT: "id": "0x{{.*}}",
528 // CHECK-NEXT: "kind": "TypedefDecl",
529 // CHECK-NEXT: "name": "TestUsingShadowDeclType"
531 // CHECK-NEXT: "inner": [
533 // CHECK-NEXT: "id": "0x0"