310 lines
9.0 KiB
C
310 lines
9.0 KiB
C
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json %s | FileCheck %s
|
|
|
|
#line 4 "test.c"
|
|
int a;
|
|
|
|
#line 32 "bar.h"
|
|
int b;
|
|
int c;
|
|
|
|
#line 11 "test.c"
|
|
int d;
|
|
int e;
|
|
// NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
|
|
|
|
|
|
// CHECK: "kind": "TranslationUnitDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "TypedefDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "isImplicit": true,
|
|
// CHECK-NEXT: "name": "__int128_t",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "__int128"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "BuiltinType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "__int128"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "TypedefDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "isImplicit": true,
|
|
// CHECK-NEXT: "name": "__uint128_t",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "unsigned __int128"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "BuiltinType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "unsigned __int128"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "TypedefDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "isImplicit": true,
|
|
// CHECK-NEXT: "name": "__NSConstantString",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "struct __NSConstantString_tag"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "RecordType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "struct __NSConstantString_tag"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "decl": {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "RecordDecl",
|
|
// CHECK-NEXT: "name": "__NSConstantString_tag"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "TypedefDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "isImplicit": true,
|
|
// CHECK-NEXT: "name": "__builtin_ms_va_list",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "char *"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "PointerType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "char *"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "BuiltinType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "char"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "TypedefDecl",
|
|
// CHECK-NEXT: "loc": {},
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {},
|
|
// CHECK-NEXT: "end": {}
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "isImplicit": true,
|
|
// CHECK-NEXT: "name": "__builtin_va_list",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "struct __va_list_tag [1]"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "ConstantArrayType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "struct __va_list_tag [1]"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "size": 1,
|
|
// CHECK-NEXT: "inner": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "RecordType",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "struct __va_list_tag"
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "decl": {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "RecordDecl",
|
|
// CHECK-NEXT: "name": "__va_list_tag"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "VarDecl",
|
|
// CHECK-NEXT: "loc": {
|
|
// CHECK-NEXT: "offset": 105,
|
|
// CHECK-NEXT: "file": "{{.*}}",
|
|
// CHECK-NEXT: "line": 4,
|
|
// CHECK-NEXT: "presumedFile": "test.c",
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {
|
|
// CHECK-NEXT: "offset": 101,
|
|
// CHECK-NEXT: "col": 1,
|
|
// CHECK-NEXT: "tokLen": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "offset": 105,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "name": "a",
|
|
// CHECK-NEXT: "mangledName": "a",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "int"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "VarDecl",
|
|
// CHECK-NEXT: "loc": {
|
|
// CHECK-NEXT: "offset": 130,
|
|
// CHECK-NEXT: "line": 7,
|
|
// CHECK-NEXT: "presumedFile": "bar.h",
|
|
// CHECK-NEXT: "presumedLine": 32,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {
|
|
// CHECK-NEXT: "offset": 126,
|
|
// CHECK-NEXT: "col": 1,
|
|
// CHECK-NEXT: "tokLen": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "offset": 130,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "name": "b",
|
|
// CHECK-NEXT: "mangledName": "b",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "int"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "VarDecl",
|
|
// CHECK-NEXT: "loc": {
|
|
// CHECK-NEXT: "offset": 137,
|
|
// CHECK-NEXT: "line": 8,
|
|
// CHECK-NEXT: "presumedLine": 33,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {
|
|
// CHECK-NEXT: "offset": 133,
|
|
// CHECK-NEXT: "col": 1,
|
|
// CHECK-NEXT: "tokLen": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "offset": 137,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "name": "c",
|
|
// CHECK-NEXT: "mangledName": "c",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "int"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "VarDecl",
|
|
// CHECK-NEXT: "loc": {
|
|
// CHECK-NEXT: "offset": 163,
|
|
// CHECK-NEXT: "line": 11,
|
|
// CHECK-NEXT: "presumedFile": "test.c",
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {
|
|
// CHECK-NEXT: "offset": 159,
|
|
// CHECK-NEXT: "col": 1,
|
|
// CHECK-NEXT: "tokLen": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "offset": 163,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "name": "d",
|
|
// CHECK-NEXT: "mangledName": "d",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "int"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: {
|
|
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
// CHECK-NEXT: "kind": "VarDecl",
|
|
// CHECK-NEXT: "loc": {
|
|
// CHECK-NEXT: "offset": 170,
|
|
// CHECK-NEXT: "line": 12,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "range": {
|
|
// CHECK-NEXT: "begin": {
|
|
// CHECK-NEXT: "offset": 166,
|
|
// CHECK-NEXT: "col": 1,
|
|
// CHECK-NEXT: "tokLen": 3
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "end": {
|
|
// CHECK-NEXT: "offset": 170,
|
|
// CHECK-NEXT: "col": 5,
|
|
// CHECK-NEXT: "tokLen": 1
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: },
|
|
// CHECK-NEXT: "name": "e",
|
|
// CHECK-NEXT: "mangledName": "e",
|
|
// CHECK-NEXT: "type": {
|
|
// CHECK-NEXT: "qualType": "int"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: }
|