• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json %s | FileCheck %s
2 
3 #define FOO frobble
4 #define BAR FOO
5 
6 void FOO(void);
7 void BAR(void);
8 
9 #define BING(x)	x
10 
11 void BING(quux)(void);
12 
13 #define BLIP(x, y) x ## y
14 #define BLAP(x, y) BLIP(x, y)
15 
16 void BLAP(foo, __COUNTER__)(void);
17 void BLAP(foo, __COUNTER__)(void);
18 
19 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
20 // using --filters=FunctionDecl
21 
22 
23 // CHECK:  "kind": "FunctionDecl",
24 // CHECK-NEXT:  "loc": {
25 // CHECK-NEXT:   "spellingLoc": {
26 // CHECK-NEXT:    "offset": 96,
27 // CHECK-NEXT:    "file": "{{.*}}",
28 // CHECK-NEXT:    "line": 3,
29 // CHECK-NEXT:    "col": 13,
30 // CHECK-NEXT:    "tokLen": 7
31 // CHECK-NEXT:   },
32 // CHECK-NEXT:   "expansionLoc": {
33 // CHECK-NEXT:    "offset": 126,
34 // CHECK-NEXT:    "line": 6,
35 // CHECK-NEXT:    "col": 6,
36 // CHECK-NEXT:    "tokLen": 3
37 // CHECK-NEXT:   }
38 // CHECK-NEXT:  },
39 // CHECK-NEXT:  "range": {
40 // CHECK-NEXT:   "begin": {
41 // CHECK-NEXT:    "offset": 121,
42 // CHECK-NEXT:    "col": 1,
43 // CHECK-NEXT:    "tokLen": 4
44 // CHECK-NEXT:   },
45 // CHECK-NEXT:   "end": {
46 // CHECK-NEXT:    "offset": 134,
47 // CHECK-NEXT:    "col": 14,
48 // CHECK-NEXT:    "tokLen": 1
49 // CHECK-NEXT:   }
50 // CHECK-NEXT:  },
51 // CHECK-NEXT:  "name": "frobble",
52 // CHECK-NEXT:  "mangledName": "frobble",
53 // CHECK-NEXT:  "type": {
54 // CHECK-NEXT:   "qualType": "void (void)"
55 // CHECK-NEXT:  }
56 // CHECK-NEXT: }
57 
58 
59 // CHECK:  "kind": "FunctionDecl",
60 // CHECK-NEXT:  "loc": {
61 // CHECK-NEXT:   "spellingLoc": {
62 // CHECK-NEXT:    "offset": 96,
63 // CHECK-NEXT:    "line": 3,
64 // CHECK-NEXT:    "col": 13,
65 // CHECK-NEXT:    "tokLen": 7
66 // CHECK-NEXT:   },
67 // CHECK-NEXT:   "expansionLoc": {
68 // CHECK-NEXT:    "offset": 142,
69 // CHECK-NEXT:    "line": 7,
70 // CHECK-NEXT:    "col": 6,
71 // CHECK-NEXT:    "tokLen": 3
72 // CHECK-NEXT:   }
73 // CHECK-NEXT:  },
74 // CHECK-NEXT:  "range": {
75 // CHECK-NEXT:   "begin": {
76 // CHECK-NEXT:    "offset": 137,
77 // CHECK-NEXT:    "col": 1,
78 // CHECK-NEXT:    "tokLen": 4
79 // CHECK-NEXT:   },
80 // CHECK-NEXT:   "end": {
81 // CHECK-NEXT:    "offset": 150,
82 // CHECK-NEXT:    "col": 14,
83 // CHECK-NEXT:    "tokLen": 1
84 // CHECK-NEXT:   }
85 // CHECK-NEXT:  },
86 // CHECK-NEXT:  "previousDecl": "0x{{.*}}",
87 // CHECK-NEXT:  "name": "frobble",
88 // CHECK-NEXT:  "mangledName": "frobble",
89 // CHECK-NEXT:  "type": {
90 // CHECK-NEXT:   "qualType": "void (void)"
91 // CHECK-NEXT:  }
92 // CHECK-NEXT: }
93 
94 
95 // CHECK:  "kind": "FunctionDecl",
96 // CHECK-NEXT:  "loc": {
97 // CHECK-NEXT:   "spellingLoc": {
98 // CHECK-NEXT:    "offset": 183,
99 // CHECK-NEXT:    "line": 11,
100 // CHECK-NEXT:    "col": 11,
101 // CHECK-NEXT:    "tokLen": 4
102 // CHECK-NEXT:   },
103 // CHECK-NEXT:   "expansionLoc": {
104 // CHECK-NEXT:    "offset": 178,
105 // CHECK-NEXT:    "col": 6,
106 // CHECK-NEXT:    "tokLen": 4,
107 // CHECK-NEXT:    "isMacroArgExpansion": true
108 // CHECK-NEXT:   }
109 // CHECK-NEXT:  },
110 // CHECK-NEXT:  "range": {
111 // CHECK-NEXT:   "begin": {
112 // CHECK-NEXT:    "offset": 173,
113 // CHECK-NEXT:    "col": 1,
114 // CHECK-NEXT:    "tokLen": 4
115 // CHECK-NEXT:   },
116 // CHECK-NEXT:   "end": {
117 // CHECK-NEXT:    "offset": 193,
118 // CHECK-NEXT:    "col": 21,
119 // CHECK-NEXT:    "tokLen": 1
120 // CHECK-NEXT:   }
121 // CHECK-NEXT:  },
122 // CHECK-NEXT:  "name": "quux",
123 // CHECK-NEXT:  "mangledName": "quux",
124 // CHECK-NEXT:  "type": {
125 // CHECK-NEXT:   "qualType": "void (void)"
126 // CHECK-NEXT:  }
127 // CHECK-NEXT: }
128 
129 
130 // CHECK:  "kind": "FunctionDecl",
131 // CHECK-NEXT:  "loc": {
132 // CHECK-NEXT:   "spellingLoc": {
133 // CHECK-NEXT:    "offset": 4,
134 // CHECK-NEXT:    "file": "<scratch space>",
135 // CHECK-NEXT:    "line": 3,
136 // CHECK-NEXT:    "col": 1,
137 // CHECK-NEXT:    "tokLen": 4
138 // CHECK-NEXT:   },
139 // CHECK-NEXT:   "expansionLoc": {
140 // CHECK-NEXT:    "offset": 259,
141 // CHECK-NEXT:    "file": "{{.*}}",
142 // CHECK-NEXT:    "line": 16,
143 // CHECK-NEXT:    "col": 6,
144 // CHECK-NEXT:    "tokLen": 4
145 // CHECK-NEXT:   }
146 // CHECK-NEXT:  },
147 // CHECK-NEXT:  "range": {
148 // CHECK-NEXT:   "begin": {
149 // CHECK-NEXT:    "offset": 254,
150 // CHECK-NEXT:    "col": 1,
151 // CHECK-NEXT:    "tokLen": 4
152 // CHECK-NEXT:   },
153 // CHECK-NEXT:   "end": {
154 // CHECK-NEXT:    "offset": 286,
155 // CHECK-NEXT:    "col": 33,
156 // CHECK-NEXT:    "tokLen": 1
157 // CHECK-NEXT:   }
158 // CHECK-NEXT:  },
159 // CHECK-NEXT:  "name": "foo0",
160 // CHECK-NEXT:  "mangledName": "foo0",
161 // CHECK-NEXT:  "type": {
162 // CHECK-NEXT:   "qualType": "void (void)"
163 // CHECK-NEXT:  }
164 // CHECK-NEXT: }
165 
166 
167 // CHECK:  "kind": "FunctionDecl",
168 // CHECK-NEXT:  "loc": {
169 // CHECK-NEXT:   "spellingLoc": {
170 // CHECK-NEXT:    "offset": 13,
171 // CHECK-NEXT:    "file": "<scratch space>",
172 // CHECK-NEXT:    "line": 5,
173 // CHECK-NEXT:    "col": 1,
174 // CHECK-NEXT:    "tokLen": 4
175 // CHECK-NEXT:   },
176 // CHECK-NEXT:   "expansionLoc": {
177 // CHECK-NEXT:    "offset": 294,
178 // CHECK-NEXT:    "file": "{{.*}}",
179 // CHECK-NEXT:    "line": 17,
180 // CHECK-NEXT:    "col": 6,
181 // CHECK-NEXT:    "tokLen": 4
182 // CHECK-NEXT:   }
183 // CHECK-NEXT:  },
184 // CHECK-NEXT:  "range": {
185 // CHECK-NEXT:   "begin": {
186 // CHECK-NEXT:    "offset": 289,
187 // CHECK-NEXT:    "col": 1,
188 // CHECK-NEXT:    "tokLen": 4
189 // CHECK-NEXT:   },
190 // CHECK-NEXT:   "end": {
191 // CHECK-NEXT:    "offset": 321,
192 // CHECK-NEXT:    "col": 33,
193 // CHECK-NEXT:    "tokLen": 1
194 // CHECK-NEXT:   }
195 // CHECK-NEXT:  },
196 // CHECK-NEXT:  "name": "foo1",
197 // CHECK-NEXT:  "mangledName": "foo1",
198 // CHECK-NEXT:  "type": {
199 // CHECK-NEXT:   "qualType": "void (void)"
200 // CHECK-NEXT:  }
201 // CHECK-NEXT: }
202