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
|
|
|
|
|
2019-05-21 00:46:44 +08:00
|
|
|
|
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 96,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 126,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 121,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 134,
|
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: }
|
|
|
|
|
|
|
|
|
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 96,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 142,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 137,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 150,
|
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: }
|
|
|
|
|
|
|
|
|
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 183,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 178,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 173,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 193,
|
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: }
|
|
|
|
|
|
|
|
|
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 4,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 259,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 254,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 286,
|
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: }
|
|
|
|
|
|
|
|
|
|
|
|
// CHECK: "kind": "FunctionDecl",
|
|
|
|
// CHECK-NEXT: "loc": {
|
|
|
|
// CHECK-NEXT: "spellingLoc": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 13,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 294,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 289,
|
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": {
|
2019-10-16 01:30:19 +08:00
|
|
|
// CHECK-NEXT: "offset": 321,
|
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: }
|