2019-05-21 00:46:44 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json %s | FileCheck %s
|
|
|
|
|
|
|
|
#define FOO frobble
|
|
|
|
#define BAR FOO
|
|
|
|
|
|
|
|
void FOO(void);
|
|
|
|
void BAR(void);
|
|
|
|
|
|
|
|
#define BING(x) x
|
|
|
|
|
|
|
|
void BING(quux)(void);
|
|
|
|
|
|
|
|
#define BLIP(x, y) x ## y
|
|
|
|
#define BLAP(x, y) BLIP(x, y)
|
|
|
|
|
|
|
|
void BLAP(foo, __COUNTER__)(void);
|
|
|
|
void BLAP(foo, __COUNTER__)(void);
|
|
|
|
|
2019-06-21 22:37:39 +08:00
|
|
|
// NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
|
|
|
|
// using --filters=FunctionDecl
|
|
|
|
|
2021-10-10 08:44:08 +08:00
|
|
|
// CHECK-NOT: {{^}}Dumping
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "file": "{{.*}}",
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 3,
|
|
|
|
// CHECK-NEXT: "col": 13,
|
|
|
|
// CHECK-NEXT: "tokLen": 7
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "expansionLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 6,
|
|
|
|
// CHECK-NEXT: "col": 6,
|
|
|
|
// CHECK-NEXT: "tokLen": 3
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "range": {
|
|
|
|
// CHECK-NEXT: "begin": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 1,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "end": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 14,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 1
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "name": "frobble",
|
2019-11-15 20:33:16 +08:00
|
|
|
// CHECK-NEXT: "mangledName": "frobble",
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "type": {
|
|
|
|
// CHECK-NEXT: "qualType": "void (void)"
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2021-10-10 08:44:08 +08:00
|
|
|
// CHECK-NOT: {{^}}Dumping
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 3,
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 13,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 7
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "expansionLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 7,
|
|
|
|
// CHECK-NEXT: "col": 6,
|
|
|
|
// CHECK-NEXT: "tokLen": 3
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "range": {
|
|
|
|
// CHECK-NEXT: "begin": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 1,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "end": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 14,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 1
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "previousDecl": "0x{{.*}}",
|
|
|
|
// CHECK-NEXT: "name": "frobble",
|
2019-11-15 20:33:16 +08:00
|
|
|
// CHECK-NEXT: "mangledName": "frobble",
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "type": {
|
|
|
|
// CHECK-NEXT: "qualType": "void (void)"
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2021-10-10 08:44:08 +08:00
|
|
|
// CHECK-NOT: {{^}}Dumping
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 11,
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 11,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "expansionLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "col": 6,
|
|
|
|
// CHECK-NEXT: "tokLen": 4,
|
|
|
|
// CHECK-NEXT: "isMacroArgExpansion": true
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "range": {
|
|
|
|
// CHECK-NEXT: "begin": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 1,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "end": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 21,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 1
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "name": "quux",
|
2019-11-15 20:33:16 +08:00
|
|
|
// CHECK-NEXT: "mangledName": "quux",
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "type": {
|
|
|
|
// CHECK-NEXT: "qualType": "void (void)"
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2021-10-10 08:44:08 +08:00
|
|
|
// CHECK-NOT: {{^}}Dumping
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "file": "<scratch space>",
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 3,
|
|
|
|
// CHECK-NEXT: "col": 1,
|
|
|
|
// CHECK-NEXT: "tokLen": 4
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "expansionLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "file": "{{.*}}",
|
|
|
|
// CHECK-NEXT: "line": 16,
|
|
|
|
// CHECK-NEXT: "col": 6,
|
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "range": {
|
|
|
|
// CHECK-NEXT: "begin": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 1,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "end": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 33,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 1
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "name": "foo0",
|
2019-11-15 20:33:16 +08:00
|
|
|
// CHECK-NEXT: "mangledName": "foo0",
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "type": {
|
|
|
|
// CHECK-NEXT: "qualType": "void (void)"
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2021-10-10 08:44:08 +08:00
|
|
|
// CHECK-NOT: {{^}}Dumping
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "file": "<scratch space>",
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "line": 5,
|
|
|
|
// CHECK-NEXT: "col": 1,
|
|
|
|
// CHECK-NEXT: "tokLen": 4
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "expansionLoc": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "file": "{{.*}}",
|
|
|
|
// CHECK-NEXT: "line": 17,
|
|
|
|
// CHECK-NEXT: "col": 6,
|
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "range": {
|
|
|
|
// CHECK-NEXT: "begin": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 1,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 4
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "end": {
|
2022-01-20 07:55:20 +08:00
|
|
|
// CHECK-NEXT: "offset": {{[0-9]+}},
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "col": 33,
|
2019-06-25 04:07:11 +08:00
|
|
|
// CHECK-NEXT: "tokLen": 1
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: },
|
|
|
|
// CHECK-NEXT: "name": "foo1",
|
2019-11-15 20:33:16 +08:00
|
|
|
// CHECK-NEXT: "mangledName": "foo1",
|
2019-05-21 00:46:44 +08:00
|
|
|
// CHECK-NEXT: "type": {
|
|
|
|
// CHECK-NEXT: "qualType": "void (void)"
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|