1 // RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++17 -ast-dump=json %s | FileCheck %s
2 
func(int val)3 void func(int val) {
4   if (val)
5     ;
6 
7   if (val)
8     ;
9   else
10     ;
11 
12   if (val)
13     ;
14   else if (val)
15     ;
16   else
17     ;
18 
19   if constexpr(10 == 10)
20     ;
21 
22   if (int i = 12)
23     ;
24 
25   if (int i = 12; i)
26     ;
27 }
28 
29 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
30 // using --filters=IfStmt
31 
32 
33 // CHECK:  "kind": "IfStmt",
34 // CHECK-NEXT:  "range": {
35 // CHECK-NEXT:   "begin": {
36 // CHECK-NEXT:    "offset": 111,
37 // CHECK-NEXT:    "line": 4,
38 // CHECK-NEXT:    "col": 3,
39 // CHECK-NEXT:    "tokLen": 2
40 // CHECK-NEXT:   },
41 // CHECK-NEXT:   "end": {
42 // CHECK-NEXT:    "offset": 124,
43 // CHECK-NEXT:    "line": 5,
44 // CHECK-NEXT:    "col": 5,
45 // CHECK-NEXT:    "tokLen": 1
46 // CHECK-NEXT:   }
47 // CHECK-NEXT:  },
48 // CHECK-NEXT:  "inner": [
49 // CHECK-NEXT:   {
50 // CHECK-NEXT:    "id": "0x{{.*}}",
51 // CHECK-NEXT:    "kind": "ImplicitCastExpr",
52 // CHECK-NEXT:    "range": {
53 // CHECK-NEXT:     "begin": {
54 // CHECK-NEXT:      "offset": 115,
55 // CHECK-NEXT:      "line": 4,
56 // CHECK-NEXT:      "col": 7,
57 // CHECK-NEXT:      "tokLen": 3
58 // CHECK-NEXT:     },
59 // CHECK-NEXT:     "end": {
60 // CHECK-NEXT:      "offset": 115,
61 // CHECK-NEXT:      "col": 7,
62 // CHECK-NEXT:      "tokLen": 3
63 // CHECK-NEXT:     }
64 // CHECK-NEXT:    },
65 // CHECK-NEXT:    "type": {
66 // CHECK-NEXT:     "qualType": "bool"
67 // CHECK-NEXT:    },
68 // CHECK-NEXT:    "valueCategory": "rvalue",
69 // CHECK-NEXT:    "castKind": "IntegralToBoolean",
70 // CHECK-NEXT:    "inner": [
71 // CHECK-NEXT:     {
72 // CHECK-NEXT:      "id": "0x{{.*}}",
73 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
74 // CHECK-NEXT:      "range": {
75 // CHECK-NEXT:       "begin": {
76 // CHECK-NEXT:        "offset": 115,
77 // CHECK-NEXT:        "col": 7,
78 // CHECK-NEXT:        "tokLen": 3
79 // CHECK-NEXT:       },
80 // CHECK-NEXT:       "end": {
81 // CHECK-NEXT:        "offset": 115,
82 // CHECK-NEXT:        "col": 7,
83 // CHECK-NEXT:        "tokLen": 3
84 // CHECK-NEXT:       }
85 // CHECK-NEXT:      },
86 // CHECK-NEXT:      "type": {
87 // CHECK-NEXT:       "qualType": "int"
88 // CHECK-NEXT:      },
89 // CHECK-NEXT:      "valueCategory": "rvalue",
90 // CHECK-NEXT:      "castKind": "LValueToRValue",
91 // CHECK-NEXT:      "inner": [
92 // CHECK-NEXT:       {
93 // CHECK-NEXT:        "id": "0x{{.*}}",
94 // CHECK-NEXT:        "kind": "DeclRefExpr",
95 // CHECK-NEXT:        "range": {
96 // CHECK-NEXT:         "begin": {
97 // CHECK-NEXT:          "offset": 115,
98 // CHECK-NEXT:          "col": 7,
99 // CHECK-NEXT:          "tokLen": 3
100 // CHECK-NEXT:         },
101 // CHECK-NEXT:         "end": {
102 // CHECK-NEXT:          "offset": 115,
103 // CHECK-NEXT:          "col": 7,
104 // CHECK-NEXT:          "tokLen": 3
105 // CHECK-NEXT:         }
106 // CHECK-NEXT:        },
107 // CHECK-NEXT:        "type": {
108 // CHECK-NEXT:         "qualType": "int"
109 // CHECK-NEXT:        },
110 // CHECK-NEXT:        "valueCategory": "lvalue",
111 // CHECK-NEXT:        "referencedDecl": {
112 // CHECK-NEXT:         "id": "0x{{.*}}",
113 // CHECK-NEXT:         "kind": "ParmVarDecl",
114 // CHECK-NEXT:         "name": "val",
115 // CHECK-NEXT:         "type": {
116 // CHECK-NEXT:          "qualType": "int"
117 // CHECK-NEXT:         }
118 // CHECK-NEXT:        }
119 // CHECK-NEXT:       }
120 // CHECK-NEXT:      ]
121 // CHECK-NEXT:     }
122 // CHECK-NEXT:    ]
123 // CHECK-NEXT:   },
124 // CHECK-NEXT:   {
125 // CHECK-NEXT:    "id": "0x{{.*}}",
126 // CHECK-NEXT:    "kind": "NullStmt",
127 // CHECK-NEXT:    "range": {
128 // CHECK-NEXT:     "begin": {
129 // CHECK-NEXT:      "offset": 124,
130 // CHECK-NEXT:      "line": 5,
131 // CHECK-NEXT:      "col": 5,
132 // CHECK-NEXT:      "tokLen": 1
133 // CHECK-NEXT:     },
134 // CHECK-NEXT:     "end": {
135 // CHECK-NEXT:      "offset": 124,
136 // CHECK-NEXT:      "col": 5,
137 // CHECK-NEXT:      "tokLen": 1
138 // CHECK-NEXT:     }
139 // CHECK-NEXT:    }
140 // CHECK-NEXT:   }
141 // CHECK-NEXT:  ]
142 // CHECK-NEXT: }
143 
144 
145 // CHECK:  "kind": "IfStmt",
146 // CHECK-NEXT:  "range": {
147 // CHECK-NEXT:   "begin": {
148 // CHECK-NEXT:    "offset": 129,
149 // CHECK-NEXT:    "line": 7,
150 // CHECK-NEXT:    "col": 3,
151 // CHECK-NEXT:    "tokLen": 2
152 // CHECK-NEXT:   },
153 // CHECK-NEXT:   "end": {
154 // CHECK-NEXT:    "offset": 155,
155 // CHECK-NEXT:    "line": 10,
156 // CHECK-NEXT:    "col": 5,
157 // CHECK-NEXT:    "tokLen": 1
158 // CHECK-NEXT:   }
159 // CHECK-NEXT:  },
160 // CHECK-NEXT:  "hasElse": true,
161 // CHECK-NEXT:  "inner": [
162 // CHECK-NEXT:   {
163 // CHECK-NEXT:    "id": "0x{{.*}}",
164 // CHECK-NEXT:    "kind": "ImplicitCastExpr",
165 // CHECK-NEXT:    "range": {
166 // CHECK-NEXT:     "begin": {
167 // CHECK-NEXT:      "offset": 133,
168 // CHECK-NEXT:      "line": 7,
169 // CHECK-NEXT:      "col": 7,
170 // CHECK-NEXT:      "tokLen": 3
171 // CHECK-NEXT:     },
172 // CHECK-NEXT:     "end": {
173 // CHECK-NEXT:      "offset": 133,
174 // CHECK-NEXT:      "col": 7,
175 // CHECK-NEXT:      "tokLen": 3
176 // CHECK-NEXT:     }
177 // CHECK-NEXT:    },
178 // CHECK-NEXT:    "type": {
179 // CHECK-NEXT:     "qualType": "bool"
180 // CHECK-NEXT:    },
181 // CHECK-NEXT:    "valueCategory": "rvalue",
182 // CHECK-NEXT:    "castKind": "IntegralToBoolean",
183 // CHECK-NEXT:    "inner": [
184 // CHECK-NEXT:     {
185 // CHECK-NEXT:      "id": "0x{{.*}}",
186 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
187 // CHECK-NEXT:      "range": {
188 // CHECK-NEXT:       "begin": {
189 // CHECK-NEXT:        "offset": 133,
190 // CHECK-NEXT:        "col": 7,
191 // CHECK-NEXT:        "tokLen": 3
192 // CHECK-NEXT:       },
193 // CHECK-NEXT:       "end": {
194 // CHECK-NEXT:        "offset": 133,
195 // CHECK-NEXT:        "col": 7,
196 // CHECK-NEXT:        "tokLen": 3
197 // CHECK-NEXT:       }
198 // CHECK-NEXT:      },
199 // CHECK-NEXT:      "type": {
200 // CHECK-NEXT:       "qualType": "int"
201 // CHECK-NEXT:      },
202 // CHECK-NEXT:      "valueCategory": "rvalue",
203 // CHECK-NEXT:      "castKind": "LValueToRValue",
204 // CHECK-NEXT:      "inner": [
205 // CHECK-NEXT:       {
206 // CHECK-NEXT:        "id": "0x{{.*}}",
207 // CHECK-NEXT:        "kind": "DeclRefExpr",
208 // CHECK-NEXT:        "range": {
209 // CHECK-NEXT:         "begin": {
210 // CHECK-NEXT:          "offset": 133,
211 // CHECK-NEXT:          "col": 7,
212 // CHECK-NEXT:          "tokLen": 3
213 // CHECK-NEXT:         },
214 // CHECK-NEXT:         "end": {
215 // CHECK-NEXT:          "offset": 133,
216 // CHECK-NEXT:          "col": 7,
217 // CHECK-NEXT:          "tokLen": 3
218 // CHECK-NEXT:         }
219 // CHECK-NEXT:        },
220 // CHECK-NEXT:        "type": {
221 // CHECK-NEXT:         "qualType": "int"
222 // CHECK-NEXT:        },
223 // CHECK-NEXT:        "valueCategory": "lvalue",
224 // CHECK-NEXT:        "referencedDecl": {
225 // CHECK-NEXT:         "id": "0x{{.*}}",
226 // CHECK-NEXT:         "kind": "ParmVarDecl",
227 // CHECK-NEXT:         "name": "val",
228 // CHECK-NEXT:         "type": {
229 // CHECK-NEXT:          "qualType": "int"
230 // CHECK-NEXT:         }
231 // CHECK-NEXT:        }
232 // CHECK-NEXT:       }
233 // CHECK-NEXT:      ]
234 // CHECK-NEXT:     }
235 // CHECK-NEXT:    ]
236 // CHECK-NEXT:   },
237 // CHECK-NEXT:   {
238 // CHECK-NEXT:    "id": "0x{{.*}}",
239 // CHECK-NEXT:    "kind": "NullStmt",
240 // CHECK-NEXT:    "range": {
241 // CHECK-NEXT:     "begin": {
242 // CHECK-NEXT:      "offset": 142,
243 // CHECK-NEXT:      "line": 8,
244 // CHECK-NEXT:      "col": 5,
245 // CHECK-NEXT:      "tokLen": 1
246 // CHECK-NEXT:     },
247 // CHECK-NEXT:     "end": {
248 // CHECK-NEXT:      "offset": 142,
249 // CHECK-NEXT:      "col": 5,
250 // CHECK-NEXT:      "tokLen": 1
251 // CHECK-NEXT:     }
252 // CHECK-NEXT:    }
253 // CHECK-NEXT:   },
254 // CHECK-NEXT:   {
255 // CHECK-NEXT:    "id": "0x{{.*}}",
256 // CHECK-NEXT:    "kind": "NullStmt",
257 // CHECK-NEXT:    "range": {
258 // CHECK-NEXT:     "begin": {
259 // CHECK-NEXT:      "offset": 155,
260 // CHECK-NEXT:      "line": 10,
261 // CHECK-NEXT:      "col": 5,
262 // CHECK-NEXT:      "tokLen": 1
263 // CHECK-NEXT:     },
264 // CHECK-NEXT:     "end": {
265 // CHECK-NEXT:      "offset": 155,
266 // CHECK-NEXT:      "col": 5,
267 // CHECK-NEXT:      "tokLen": 1
268 // CHECK-NEXT:     }
269 // CHECK-NEXT:    }
270 // CHECK-NEXT:   }
271 // CHECK-NEXT:  ]
272 // CHECK-NEXT: }
273 
274 
275 // CHECK:  "kind": "IfStmt",
276 // CHECK-NEXT:  "range": {
277 // CHECK-NEXT:   "begin": {
278 // CHECK-NEXT:    "offset": 160,
279 // CHECK-NEXT:    "line": 12,
280 // CHECK-NEXT:    "col": 3,
281 // CHECK-NEXT:    "tokLen": 2
282 // CHECK-NEXT:   },
283 // CHECK-NEXT:   "end": {
284 // CHECK-NEXT:    "offset": 208,
285 // CHECK-NEXT:    "line": 17,
286 // CHECK-NEXT:    "col": 5,
287 // CHECK-NEXT:    "tokLen": 1
288 // CHECK-NEXT:   }
289 // CHECK-NEXT:  },
290 // CHECK-NEXT:  "hasElse": true,
291 // CHECK-NEXT:  "inner": [
292 // CHECK-NEXT:   {
293 // CHECK-NEXT:    "id": "0x{{.*}}",
294 // CHECK-NEXT:    "kind": "ImplicitCastExpr",
295 // CHECK-NEXT:    "range": {
296 // CHECK-NEXT:     "begin": {
297 // CHECK-NEXT:      "offset": 164,
298 // CHECK-NEXT:      "line": 12,
299 // CHECK-NEXT:      "col": 7,
300 // CHECK-NEXT:      "tokLen": 3
301 // CHECK-NEXT:     },
302 // CHECK-NEXT:     "end": {
303 // CHECK-NEXT:      "offset": 164,
304 // CHECK-NEXT:      "col": 7,
305 // CHECK-NEXT:      "tokLen": 3
306 // CHECK-NEXT:     }
307 // CHECK-NEXT:    },
308 // CHECK-NEXT:    "type": {
309 // CHECK-NEXT:     "qualType": "bool"
310 // CHECK-NEXT:    },
311 // CHECK-NEXT:    "valueCategory": "rvalue",
312 // CHECK-NEXT:    "castKind": "IntegralToBoolean",
313 // CHECK-NEXT:    "inner": [
314 // CHECK-NEXT:     {
315 // CHECK-NEXT:      "id": "0x{{.*}}",
316 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
317 // CHECK-NEXT:      "range": {
318 // CHECK-NEXT:       "begin": {
319 // CHECK-NEXT:        "offset": 164,
320 // CHECK-NEXT:        "col": 7,
321 // CHECK-NEXT:        "tokLen": 3
322 // CHECK-NEXT:       },
323 // CHECK-NEXT:       "end": {
324 // CHECK-NEXT:        "offset": 164,
325 // CHECK-NEXT:        "col": 7,
326 // CHECK-NEXT:        "tokLen": 3
327 // CHECK-NEXT:       }
328 // CHECK-NEXT:      },
329 // CHECK-NEXT:      "type": {
330 // CHECK-NEXT:       "qualType": "int"
331 // CHECK-NEXT:      },
332 // CHECK-NEXT:      "valueCategory": "rvalue",
333 // CHECK-NEXT:      "castKind": "LValueToRValue",
334 // CHECK-NEXT:      "inner": [
335 // CHECK-NEXT:       {
336 // CHECK-NEXT:        "id": "0x{{.*}}",
337 // CHECK-NEXT:        "kind": "DeclRefExpr",
338 // CHECK-NEXT:        "range": {
339 // CHECK-NEXT:         "begin": {
340 // CHECK-NEXT:          "offset": 164,
341 // CHECK-NEXT:          "col": 7,
342 // CHECK-NEXT:          "tokLen": 3
343 // CHECK-NEXT:         },
344 // CHECK-NEXT:         "end": {
345 // CHECK-NEXT:          "offset": 164,
346 // CHECK-NEXT:          "col": 7,
347 // CHECK-NEXT:          "tokLen": 3
348 // CHECK-NEXT:         }
349 // CHECK-NEXT:        },
350 // CHECK-NEXT:        "type": {
351 // CHECK-NEXT:         "qualType": "int"
352 // CHECK-NEXT:        },
353 // CHECK-NEXT:        "valueCategory": "lvalue",
354 // CHECK-NEXT:        "referencedDecl": {
355 // CHECK-NEXT:         "id": "0x{{.*}}",
356 // CHECK-NEXT:         "kind": "ParmVarDecl",
357 // CHECK-NEXT:         "name": "val",
358 // CHECK-NEXT:         "type": {
359 // CHECK-NEXT:          "qualType": "int"
360 // CHECK-NEXT:         }
361 // CHECK-NEXT:        }
362 // CHECK-NEXT:       }
363 // CHECK-NEXT:      ]
364 // CHECK-NEXT:     }
365 // CHECK-NEXT:    ]
366 // CHECK-NEXT:   },
367 // CHECK-NEXT:   {
368 // CHECK-NEXT:    "id": "0x{{.*}}",
369 // CHECK-NEXT:    "kind": "NullStmt",
370 // CHECK-NEXT:    "range": {
371 // CHECK-NEXT:     "begin": {
372 // CHECK-NEXT:      "offset": 173,
373 // CHECK-NEXT:      "line": 13,
374 // CHECK-NEXT:      "col": 5,
375 // CHECK-NEXT:      "tokLen": 1
376 // CHECK-NEXT:     },
377 // CHECK-NEXT:     "end": {
378 // CHECK-NEXT:      "offset": 173,
379 // CHECK-NEXT:      "col": 5,
380 // CHECK-NEXT:      "tokLen": 1
381 // CHECK-NEXT:     }
382 // CHECK-NEXT:    }
383 // CHECK-NEXT:   },
384 // CHECK-NEXT:   {
385 // CHECK-NEXT:    "id": "0x{{.*}}",
386 // CHECK-NEXT:    "kind": "IfStmt",
387 // CHECK-NEXT:    "range": {
388 // CHECK-NEXT:     "begin": {
389 // CHECK-NEXT:      "offset": 182,
390 // CHECK-NEXT:      "line": 14,
391 // CHECK-NEXT:      "col": 8,
392 // CHECK-NEXT:      "tokLen": 2
393 // CHECK-NEXT:     },
394 // CHECK-NEXT:     "end": {
395 // CHECK-NEXT:      "offset": 208,
396 // CHECK-NEXT:      "line": 17,
397 // CHECK-NEXT:      "col": 5,
398 // CHECK-NEXT:      "tokLen": 1
399 // CHECK-NEXT:     }
400 // CHECK-NEXT:    },
401 // CHECK-NEXT:    "hasElse": true,
402 // CHECK-NEXT:    "inner": [
403 // CHECK-NEXT:     {
404 // CHECK-NEXT:      "id": "0x{{.*}}",
405 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
406 // CHECK-NEXT:      "range": {
407 // CHECK-NEXT:       "begin": {
408 // CHECK-NEXT:        "offset": 186,
409 // CHECK-NEXT:        "line": 14,
410 // CHECK-NEXT:        "col": 12,
411 // CHECK-NEXT:        "tokLen": 3
412 // CHECK-NEXT:       },
413 // CHECK-NEXT:       "end": {
414 // CHECK-NEXT:        "offset": 186,
415 // CHECK-NEXT:        "col": 12,
416 // CHECK-NEXT:        "tokLen": 3
417 // CHECK-NEXT:       }
418 // CHECK-NEXT:      },
419 // CHECK-NEXT:      "type": {
420 // CHECK-NEXT:       "qualType": "bool"
421 // CHECK-NEXT:      },
422 // CHECK-NEXT:      "valueCategory": "rvalue",
423 // CHECK-NEXT:      "castKind": "IntegralToBoolean",
424 // CHECK-NEXT:      "inner": [
425 // CHECK-NEXT:       {
426 // CHECK-NEXT:        "id": "0x{{.*}}",
427 // CHECK-NEXT:        "kind": "ImplicitCastExpr",
428 // CHECK-NEXT:        "range": {
429 // CHECK-NEXT:         "begin": {
430 // CHECK-NEXT:          "offset": 186,
431 // CHECK-NEXT:          "col": 12,
432 // CHECK-NEXT:          "tokLen": 3
433 // CHECK-NEXT:         },
434 // CHECK-NEXT:         "end": {
435 // CHECK-NEXT:          "offset": 186,
436 // CHECK-NEXT:          "col": 12,
437 // CHECK-NEXT:          "tokLen": 3
438 // CHECK-NEXT:         }
439 // CHECK-NEXT:        },
440 // CHECK-NEXT:        "type": {
441 // CHECK-NEXT:         "qualType": "int"
442 // CHECK-NEXT:        },
443 // CHECK-NEXT:        "valueCategory": "rvalue",
444 // CHECK-NEXT:        "castKind": "LValueToRValue",
445 // CHECK-NEXT:        "inner": [
446 // CHECK-NEXT:         {
447 // CHECK-NEXT:          "id": "0x{{.*}}",
448 // CHECK-NEXT:          "kind": "DeclRefExpr",
449 // CHECK-NEXT:          "range": {
450 // CHECK-NEXT:           "begin": {
451 // CHECK-NEXT:            "offset": 186,
452 // CHECK-NEXT:            "col": 12,
453 // CHECK-NEXT:            "tokLen": 3
454 // CHECK-NEXT:           },
455 // CHECK-NEXT:           "end": {
456 // CHECK-NEXT:            "offset": 186,
457 // CHECK-NEXT:            "col": 12,
458 // CHECK-NEXT:            "tokLen": 3
459 // CHECK-NEXT:           }
460 // CHECK-NEXT:          },
461 // CHECK-NEXT:          "type": {
462 // CHECK-NEXT:           "qualType": "int"
463 // CHECK-NEXT:          },
464 // CHECK-NEXT:          "valueCategory": "lvalue",
465 // CHECK-NEXT:          "referencedDecl": {
466 // CHECK-NEXT:           "id": "0x{{.*}}",
467 // CHECK-NEXT:           "kind": "ParmVarDecl",
468 // CHECK-NEXT:           "name": "val",
469 // CHECK-NEXT:           "type": {
470 // CHECK-NEXT:            "qualType": "int"
471 // CHECK-NEXT:           }
472 // CHECK-NEXT:          }
473 // CHECK-NEXT:         }
474 // CHECK-NEXT:        ]
475 // CHECK-NEXT:       }
476 // CHECK-NEXT:      ]
477 // CHECK-NEXT:     },
478 // CHECK-NEXT:     {
479 // CHECK-NEXT:      "id": "0x{{.*}}",
480 // CHECK-NEXT:      "kind": "NullStmt",
481 // CHECK-NEXT:      "range": {
482 // CHECK-NEXT:       "begin": {
483 // CHECK-NEXT:        "offset": 195,
484 // CHECK-NEXT:        "line": 15,
485 // CHECK-NEXT:        "col": 5,
486 // CHECK-NEXT:        "tokLen": 1
487 // CHECK-NEXT:       },
488 // CHECK-NEXT:       "end": {
489 // CHECK-NEXT:        "offset": 195,
490 // CHECK-NEXT:        "col": 5,
491 // CHECK-NEXT:        "tokLen": 1
492 // CHECK-NEXT:       }
493 // CHECK-NEXT:      }
494 // CHECK-NEXT:     },
495 // CHECK-NEXT:     {
496 // CHECK-NEXT:      "id": "0x{{.*}}",
497 // CHECK-NEXT:      "kind": "NullStmt",
498 // CHECK-NEXT:      "range": {
499 // CHECK-NEXT:       "begin": {
500 // CHECK-NEXT:        "offset": 208,
501 // CHECK-NEXT:        "line": 17,
502 // CHECK-NEXT:        "col": 5,
503 // CHECK-NEXT:        "tokLen": 1
504 // CHECK-NEXT:       },
505 // CHECK-NEXT:       "end": {
506 // CHECK-NEXT:        "offset": 208,
507 // CHECK-NEXT:        "col": 5,
508 // CHECK-NEXT:        "tokLen": 1
509 // CHECK-NEXT:       }
510 // CHECK-NEXT:      }
511 // CHECK-NEXT:     }
512 // CHECK-NEXT:    ]
513 // CHECK-NEXT:   }
514 // CHECK-NEXT:  ]
515 // CHECK-NEXT: }
516 
517 
518 // CHECK:  "kind": "IfStmt",
519 // CHECK-NEXT:  "range": {
520 // CHECK-NEXT:   "begin": {
521 // CHECK-NEXT:    "offset": 213,
522 // CHECK-NEXT:    "line": 19,
523 // CHECK-NEXT:    "col": 3,
524 // CHECK-NEXT:    "tokLen": 2
525 // CHECK-NEXT:   },
526 // CHECK-NEXT:   "end": {
527 // CHECK-NEXT:    "offset": 240,
528 // CHECK-NEXT:    "line": 20,
529 // CHECK-NEXT:    "col": 5,
530 // CHECK-NEXT:    "tokLen": 1
531 // CHECK-NEXT:   }
532 // CHECK-NEXT:  },
533 // CHECK-NEXT:  "isConstexpr": true,
534 // CHECK-NEXT:  "inner": [
535 // CHECK-NEXT:   {
536 // CHECK-NEXT:    "id": "0x{{.*}}",
537 // CHECK-NEXT:    "kind": "ConstantExpr",
538 // CHECK-NEXT:    "range": {
539 // CHECK-NEXT:     "begin": {
540 // CHECK-NEXT:      "offset": 226,
541 // CHECK-NEXT:      "line": 19,
542 // CHECK-NEXT:      "col": 16,
543 // CHECK-NEXT:      "tokLen": 2
544 // CHECK-NEXT:     },
545 // CHECK-NEXT:     "end": {
546 // CHECK-NEXT:      "offset": 232,
547 // CHECK-NEXT:      "col": 22,
548 // CHECK-NEXT:      "tokLen": 2
549 // CHECK-NEXT:     }
550 // CHECK-NEXT:    },
551 // CHECK-NEXT:    "type": {
552 // CHECK-NEXT:     "qualType": "bool"
553 // CHECK-NEXT:    },
554 // CHECK-NEXT:    "valueCategory": "rvalue",
555 // CHECK-NEXT:    "value": "true",
556 // CHECK-NEXT:    "inner": [
557 // CHECK-NEXT:     {
558 // CHECK-NEXT:      "id": "0x{{.*}}",
559 // CHECK-NEXT:      "kind": "BinaryOperator",
560 // CHECK-NEXT:      "range": {
561 // CHECK-NEXT:       "begin": {
562 // CHECK-NEXT:        "offset": 226,
563 // CHECK-NEXT:        "col": 16,
564 // CHECK-NEXT:        "tokLen": 2
565 // CHECK-NEXT:       },
566 // CHECK-NEXT:       "end": {
567 // CHECK-NEXT:        "offset": 232,
568 // CHECK-NEXT:        "col": 22,
569 // CHECK-NEXT:        "tokLen": 2
570 // CHECK-NEXT:       }
571 // CHECK-NEXT:      },
572 // CHECK-NEXT:      "type": {
573 // CHECK-NEXT:       "qualType": "bool"
574 // CHECK-NEXT:      },
575 // CHECK-NEXT:      "valueCategory": "rvalue",
576 // CHECK-NEXT:      "opcode": "==",
577 // CHECK-NEXT:      "inner": [
578 // CHECK-NEXT:       {
579 // CHECK-NEXT:        "id": "0x{{.*}}",
580 // CHECK-NEXT:        "kind": "IntegerLiteral",
581 // CHECK-NEXT:        "range": {
582 // CHECK-NEXT:         "begin": {
583 // CHECK-NEXT:          "offset": 226,
584 // CHECK-NEXT:          "col": 16,
585 // CHECK-NEXT:          "tokLen": 2
586 // CHECK-NEXT:         },
587 // CHECK-NEXT:         "end": {
588 // CHECK-NEXT:          "offset": 226,
589 // CHECK-NEXT:          "col": 16,
590 // CHECK-NEXT:          "tokLen": 2
591 // CHECK-NEXT:         }
592 // CHECK-NEXT:        },
593 // CHECK-NEXT:        "type": {
594 // CHECK-NEXT:         "qualType": "int"
595 // CHECK-NEXT:        },
596 // CHECK-NEXT:        "valueCategory": "rvalue",
597 // CHECK-NEXT:        "value": "10"
598 // CHECK-NEXT:       },
599 // CHECK-NEXT:       {
600 // CHECK-NEXT:        "id": "0x{{.*}}",
601 // CHECK-NEXT:        "kind": "IntegerLiteral",
602 // CHECK-NEXT:        "range": {
603 // CHECK-NEXT:         "begin": {
604 // CHECK-NEXT:          "offset": 232,
605 // CHECK-NEXT:          "col": 22,
606 // CHECK-NEXT:          "tokLen": 2
607 // CHECK-NEXT:         },
608 // CHECK-NEXT:         "end": {
609 // CHECK-NEXT:          "offset": 232,
610 // CHECK-NEXT:          "col": 22,
611 // CHECK-NEXT:          "tokLen": 2
612 // CHECK-NEXT:         }
613 // CHECK-NEXT:        },
614 // CHECK-NEXT:        "type": {
615 // CHECK-NEXT:         "qualType": "int"
616 // CHECK-NEXT:        },
617 // CHECK-NEXT:        "valueCategory": "rvalue",
618 // CHECK-NEXT:        "value": "10"
619 // CHECK-NEXT:       }
620 // CHECK-NEXT:      ]
621 // CHECK-NEXT:     }
622 // CHECK-NEXT:    ]
623 // CHECK-NEXT:   },
624 // CHECK-NEXT:   {
625 // CHECK-NEXT:    "id": "0x{{.*}}",
626 // CHECK-NEXT:    "kind": "NullStmt",
627 // CHECK-NEXT:    "range": {
628 // CHECK-NEXT:     "begin": {
629 // CHECK-NEXT:      "offset": 240,
630 // CHECK-NEXT:      "line": 20,
631 // CHECK-NEXT:      "col": 5,
632 // CHECK-NEXT:      "tokLen": 1
633 // CHECK-NEXT:     },
634 // CHECK-NEXT:     "end": {
635 // CHECK-NEXT:      "offset": 240,
636 // CHECK-NEXT:      "col": 5,
637 // CHECK-NEXT:      "tokLen": 1
638 // CHECK-NEXT:     }
639 // CHECK-NEXT:    }
640 // CHECK-NEXT:   }
641 // CHECK-NEXT:  ]
642 // CHECK-NEXT: }
643 
644 
645 // CHECK:  "kind": "IfStmt",
646 // CHECK-NEXT:  "range": {
647 // CHECK-NEXT:   "begin": {
648 // CHECK-NEXT:    "offset": 245,
649 // CHECK-NEXT:    "line": 22,
650 // CHECK-NEXT:    "col": 3,
651 // CHECK-NEXT:    "tokLen": 2
652 // CHECK-NEXT:   },
653 // CHECK-NEXT:   "end": {
654 // CHECK-NEXT:    "offset": 265,
655 // CHECK-NEXT:    "line": 23,
656 // CHECK-NEXT:    "col": 5,
657 // CHECK-NEXT:    "tokLen": 1
658 // CHECK-NEXT:   }
659 // CHECK-NEXT:  },
660 // CHECK-NEXT:  "hasVar": true,
661 // CHECK-NEXT:  "inner": [
662 // CHECK-NEXT:   {
663 // CHECK-NEXT:    "id": "0x{{.*}}",
664 // CHECK-NEXT:    "kind": "DeclStmt",
665 // CHECK-NEXT:    "range": {
666 // CHECK-NEXT:     "begin": {
667 // CHECK-NEXT:      "offset": 249,
668 // CHECK-NEXT:      "line": 22,
669 // CHECK-NEXT:      "col": 7,
670 // CHECK-NEXT:      "tokLen": 3
671 // CHECK-NEXT:     },
672 // CHECK-NEXT:     "end": {
673 // CHECK-NEXT:      "offset": 257,
674 // CHECK-NEXT:      "col": 15,
675 // CHECK-NEXT:      "tokLen": 2
676 // CHECK-NEXT:     }
677 // CHECK-NEXT:    },
678 // CHECK-NEXT:    "inner": [
679 // CHECK-NEXT:     {
680 // CHECK-NEXT:      "id": "0x{{.*}}",
681 // CHECK-NEXT:      "kind": "VarDecl",
682 // CHECK-NEXT:      "loc": {
683 // CHECK-NEXT:       "offset": 253,
684 // CHECK-NEXT:       "col": 11,
685 // CHECK-NEXT:       "tokLen": 1
686 // CHECK-NEXT:      },
687 // CHECK-NEXT:      "range": {
688 // CHECK-NEXT:       "begin": {
689 // CHECK-NEXT:        "offset": 249,
690 // CHECK-NEXT:        "col": 7,
691 // CHECK-NEXT:        "tokLen": 3
692 // CHECK-NEXT:       },
693 // CHECK-NEXT:       "end": {
694 // CHECK-NEXT:        "offset": 257,
695 // CHECK-NEXT:        "col": 15,
696 // CHECK-NEXT:        "tokLen": 2
697 // CHECK-NEXT:       }
698 // CHECK-NEXT:      },
699 // CHECK-NEXT:      "isUsed": true,
700 // CHECK-NEXT:      "name": "i",
701 // CHECK-NEXT:      "mangledName": "_ZZ4funciE1i",
702 // CHECK-NEXT:      "type": {
703 // CHECK-NEXT:       "qualType": "int"
704 // CHECK-NEXT:      },
705 // CHECK-NEXT:      "init": "c",
706 // CHECK-NEXT:      "inner": [
707 // CHECK-NEXT:       {
708 // CHECK-NEXT:        "id": "0x{{.*}}",
709 // CHECK-NEXT:        "kind": "IntegerLiteral",
710 // CHECK-NEXT:        "range": {
711 // CHECK-NEXT:         "begin": {
712 // CHECK-NEXT:          "offset": 257,
713 // CHECK-NEXT:          "col": 15,
714 // CHECK-NEXT:          "tokLen": 2
715 // CHECK-NEXT:         },
716 // CHECK-NEXT:         "end": {
717 // CHECK-NEXT:          "offset": 257,
718 // CHECK-NEXT:          "col": 15,
719 // CHECK-NEXT:          "tokLen": 2
720 // CHECK-NEXT:         }
721 // CHECK-NEXT:        },
722 // CHECK-NEXT:        "type": {
723 // CHECK-NEXT:         "qualType": "int"
724 // CHECK-NEXT:        },
725 // CHECK-NEXT:        "valueCategory": "rvalue",
726 // CHECK-NEXT:        "value": "12"
727 // CHECK-NEXT:       }
728 // CHECK-NEXT:      ]
729 // CHECK-NEXT:     }
730 // CHECK-NEXT:    ]
731 // CHECK-NEXT:   },
732 // CHECK-NEXT:   {
733 // CHECK-NEXT:    "id": "0x{{.*}}",
734 // CHECK-NEXT:    "kind": "ImplicitCastExpr",
735 // CHECK-NEXT:    "range": {
736 // CHECK-NEXT:     "begin": {
737 // CHECK-NEXT:      "offset": 253,
738 // CHECK-NEXT:      "col": 11,
739 // CHECK-NEXT:      "tokLen": 1
740 // CHECK-NEXT:     },
741 // CHECK-NEXT:     "end": {
742 // CHECK-NEXT:      "offset": 253,
743 // CHECK-NEXT:      "col": 11,
744 // CHECK-NEXT:      "tokLen": 1
745 // CHECK-NEXT:     }
746 // CHECK-NEXT:    },
747 // CHECK-NEXT:    "type": {
748 // CHECK-NEXT:     "qualType": "bool"
749 // CHECK-NEXT:    },
750 // CHECK-NEXT:    "valueCategory": "rvalue",
751 // CHECK-NEXT:    "castKind": "IntegralToBoolean",
752 // CHECK-NEXT:    "inner": [
753 // CHECK-NEXT:     {
754 // CHECK-NEXT:      "id": "0x{{.*}}",
755 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
756 // CHECK-NEXT:      "range": {
757 // CHECK-NEXT:       "begin": {
758 // CHECK-NEXT:        "offset": 253,
759 // CHECK-NEXT:        "col": 11,
760 // CHECK-NEXT:        "tokLen": 1
761 // CHECK-NEXT:       },
762 // CHECK-NEXT:       "end": {
763 // CHECK-NEXT:        "offset": 253,
764 // CHECK-NEXT:        "col": 11,
765 // CHECK-NEXT:        "tokLen": 1
766 // CHECK-NEXT:       }
767 // CHECK-NEXT:      },
768 // CHECK-NEXT:      "type": {
769 // CHECK-NEXT:       "qualType": "int"
770 // CHECK-NEXT:      },
771 // CHECK-NEXT:      "valueCategory": "rvalue",
772 // CHECK-NEXT:      "castKind": "LValueToRValue",
773 // CHECK-NEXT:      "inner": [
774 // CHECK-NEXT:       {
775 // CHECK-NEXT:        "id": "0x{{.*}}",
776 // CHECK-NEXT:        "kind": "DeclRefExpr",
777 // CHECK-NEXT:        "range": {
778 // CHECK-NEXT:         "begin": {
779 // CHECK-NEXT:          "offset": 253,
780 // CHECK-NEXT:          "col": 11,
781 // CHECK-NEXT:          "tokLen": 1
782 // CHECK-NEXT:         },
783 // CHECK-NEXT:         "end": {
784 // CHECK-NEXT:          "offset": 253,
785 // CHECK-NEXT:          "col": 11,
786 // CHECK-NEXT:          "tokLen": 1
787 // CHECK-NEXT:         }
788 // CHECK-NEXT:        },
789 // CHECK-NEXT:        "type": {
790 // CHECK-NEXT:         "qualType": "int"
791 // CHECK-NEXT:        },
792 // CHECK-NEXT:        "valueCategory": "lvalue",
793 // CHECK-NEXT:        "referencedDecl": {
794 // CHECK-NEXT:         "id": "0x{{.*}}",
795 // CHECK-NEXT:         "kind": "VarDecl",
796 // CHECK-NEXT:         "name": "i",
797 // CHECK-NEXT:         "type": {
798 // CHECK-NEXT:          "qualType": "int"
799 // CHECK-NEXT:         }
800 // CHECK-NEXT:        }
801 // CHECK-NEXT:       }
802 // CHECK-NEXT:      ]
803 // CHECK-NEXT:     }
804 // CHECK-NEXT:    ]
805 // CHECK-NEXT:   },
806 // CHECK-NEXT:   {
807 // CHECK-NEXT:    "id": "0x{{.*}}",
808 // CHECK-NEXT:    "kind": "NullStmt",
809 // CHECK-NEXT:    "range": {
810 // CHECK-NEXT:     "begin": {
811 // CHECK-NEXT:      "offset": 265,
812 // CHECK-NEXT:      "line": 23,
813 // CHECK-NEXT:      "col": 5,
814 // CHECK-NEXT:      "tokLen": 1
815 // CHECK-NEXT:     },
816 // CHECK-NEXT:     "end": {
817 // CHECK-NEXT:      "offset": 265,
818 // CHECK-NEXT:      "col": 5,
819 // CHECK-NEXT:      "tokLen": 1
820 // CHECK-NEXT:     }
821 // CHECK-NEXT:    }
822 // CHECK-NEXT:   }
823 // CHECK-NEXT:  ]
824 // CHECK-NEXT: }
825 
826 
827 // CHECK:  "kind": "IfStmt",
828 // CHECK-NEXT:  "range": {
829 // CHECK-NEXT:   "begin": {
830 // CHECK-NEXT:    "offset": 270,
831 // CHECK-NEXT:    "line": 25,
832 // CHECK-NEXT:    "col": 3,
833 // CHECK-NEXT:    "tokLen": 2
834 // CHECK-NEXT:   },
835 // CHECK-NEXT:   "end": {
836 // CHECK-NEXT:    "offset": 293,
837 // CHECK-NEXT:    "line": 26,
838 // CHECK-NEXT:    "col": 5,
839 // CHECK-NEXT:    "tokLen": 1
840 // CHECK-NEXT:   }
841 // CHECK-NEXT:  },
842 // CHECK-NEXT:  "hasInit": true,
843 // CHECK-NEXT:  "inner": [
844 // CHECK-NEXT:   {
845 // CHECK-NEXT:    "id": "0x{{.*}}",
846 // CHECK-NEXT:    "kind": "DeclStmt",
847 // CHECK-NEXT:    "range": {
848 // CHECK-NEXT:     "begin": {
849 // CHECK-NEXT:      "offset": 274,
850 // CHECK-NEXT:      "line": 25,
851 // CHECK-NEXT:      "col": 7,
852 // CHECK-NEXT:      "tokLen": 3
853 // CHECK-NEXT:     },
854 // CHECK-NEXT:     "end": {
855 // CHECK-NEXT:      "offset": 284,
856 // CHECK-NEXT:      "col": 17,
857 // CHECK-NEXT:      "tokLen": 1
858 // CHECK-NEXT:     }
859 // CHECK-NEXT:    },
860 // CHECK-NEXT:    "inner": [
861 // CHECK-NEXT:     {
862 // CHECK-NEXT:      "id": "0x{{.*}}",
863 // CHECK-NEXT:      "kind": "VarDecl",
864 // CHECK-NEXT:      "loc": {
865 // CHECK-NEXT:       "offset": 278,
866 // CHECK-NEXT:       "col": 11,
867 // CHECK-NEXT:       "tokLen": 1
868 // CHECK-NEXT:      },
869 // CHECK-NEXT:      "range": {
870 // CHECK-NEXT:       "begin": {
871 // CHECK-NEXT:        "offset": 274,
872 // CHECK-NEXT:        "col": 7,
873 // CHECK-NEXT:        "tokLen": 3
874 // CHECK-NEXT:       },
875 // CHECK-NEXT:       "end": {
876 // CHECK-NEXT:        "offset": 282,
877 // CHECK-NEXT:        "col": 15,
878 // CHECK-NEXT:        "tokLen": 2
879 // CHECK-NEXT:       }
880 // CHECK-NEXT:      },
881 // CHECK-NEXT:      "isUsed": true,
882 // CHECK-NEXT:      "name": "i",
883 // CHECK-NEXT:      "mangledName": "_ZZ4funciE1i_0",
884 // CHECK-NEXT:      "type": {
885 // CHECK-NEXT:       "qualType": "int"
886 // CHECK-NEXT:      },
887 // CHECK-NEXT:      "init": "c",
888 // CHECK-NEXT:      "inner": [
889 // CHECK-NEXT:       {
890 // CHECK-NEXT:        "id": "0x{{.*}}",
891 // CHECK-NEXT:        "kind": "IntegerLiteral",
892 // CHECK-NEXT:        "range": {
893 // CHECK-NEXT:         "begin": {
894 // CHECK-NEXT:          "offset": 282,
895 // CHECK-NEXT:          "col": 15,
896 // CHECK-NEXT:          "tokLen": 2
897 // CHECK-NEXT:         },
898 // CHECK-NEXT:         "end": {
899 // CHECK-NEXT:          "offset": 282,
900 // CHECK-NEXT:          "col": 15,
901 // CHECK-NEXT:          "tokLen": 2
902 // CHECK-NEXT:         }
903 // CHECK-NEXT:        },
904 // CHECK-NEXT:        "type": {
905 // CHECK-NEXT:         "qualType": "int"
906 // CHECK-NEXT:        },
907 // CHECK-NEXT:        "valueCategory": "rvalue",
908 // CHECK-NEXT:        "value": "12"
909 // CHECK-NEXT:       }
910 // CHECK-NEXT:      ]
911 // CHECK-NEXT:     }
912 // CHECK-NEXT:    ]
913 // CHECK-NEXT:   },
914 // CHECK-NEXT:   {
915 // CHECK-NEXT:    "id": "0x{{.*}}",
916 // CHECK-NEXT:    "kind": "ImplicitCastExpr",
917 // CHECK-NEXT:    "range": {
918 // CHECK-NEXT:     "begin": {
919 // CHECK-NEXT:      "offset": 286,
920 // CHECK-NEXT:      "col": 19,
921 // CHECK-NEXT:      "tokLen": 1
922 // CHECK-NEXT:     },
923 // CHECK-NEXT:     "end": {
924 // CHECK-NEXT:      "offset": 286,
925 // CHECK-NEXT:      "col": 19,
926 // CHECK-NEXT:      "tokLen": 1
927 // CHECK-NEXT:     }
928 // CHECK-NEXT:    },
929 // CHECK-NEXT:    "type": {
930 // CHECK-NEXT:     "qualType": "bool"
931 // CHECK-NEXT:    },
932 // CHECK-NEXT:    "valueCategory": "rvalue",
933 // CHECK-NEXT:    "castKind": "IntegralToBoolean",
934 // CHECK-NEXT:    "inner": [
935 // CHECK-NEXT:     {
936 // CHECK-NEXT:      "id": "0x{{.*}}",
937 // CHECK-NEXT:      "kind": "ImplicitCastExpr",
938 // CHECK-NEXT:      "range": {
939 // CHECK-NEXT:       "begin": {
940 // CHECK-NEXT:        "offset": 286,
941 // CHECK-NEXT:        "col": 19,
942 // CHECK-NEXT:        "tokLen": 1
943 // CHECK-NEXT:       },
944 // CHECK-NEXT:       "end": {
945 // CHECK-NEXT:        "offset": 286,
946 // CHECK-NEXT:        "col": 19,
947 // CHECK-NEXT:        "tokLen": 1
948 // CHECK-NEXT:       }
949 // CHECK-NEXT:      },
950 // CHECK-NEXT:      "type": {
951 // CHECK-NEXT:       "qualType": "int"
952 // CHECK-NEXT:      },
953 // CHECK-NEXT:      "valueCategory": "rvalue",
954 // CHECK-NEXT:      "castKind": "LValueToRValue",
955 // CHECK-NEXT:      "inner": [
956 // CHECK-NEXT:       {
957 // CHECK-NEXT:        "id": "0x{{.*}}",
958 // CHECK-NEXT:        "kind": "DeclRefExpr",
959 // CHECK-NEXT:        "range": {
960 // CHECK-NEXT:         "begin": {
961 // CHECK-NEXT:          "offset": 286,
962 // CHECK-NEXT:          "col": 19,
963 // CHECK-NEXT:          "tokLen": 1
964 // CHECK-NEXT:         },
965 // CHECK-NEXT:         "end": {
966 // CHECK-NEXT:          "offset": 286,
967 // CHECK-NEXT:          "col": 19,
968 // CHECK-NEXT:          "tokLen": 1
969 // CHECK-NEXT:         }
970 // CHECK-NEXT:        },
971 // CHECK-NEXT:        "type": {
972 // CHECK-NEXT:         "qualType": "int"
973 // CHECK-NEXT:        },
974 // CHECK-NEXT:        "valueCategory": "lvalue",
975 // CHECK-NEXT:        "referencedDecl": {
976 // CHECK-NEXT:         "id": "0x{{.*}}",
977 // CHECK-NEXT:         "kind": "VarDecl",
978 // CHECK-NEXT:         "name": "i",
979 // CHECK-NEXT:         "type": {
980 // CHECK-NEXT:          "qualType": "int"
981 // CHECK-NEXT:         }
982 // CHECK-NEXT:        }
983 // CHECK-NEXT:       }
984 // CHECK-NEXT:      ]
985 // CHECK-NEXT:     }
986 // CHECK-NEXT:    ]
987 // CHECK-NEXT:   },
988 // CHECK-NEXT:   {
989 // CHECK-NEXT:    "id": "0x{{.*}}",
990 // CHECK-NEXT:    "kind": "NullStmt",
991 // CHECK-NEXT:    "range": {
992 // CHECK-NEXT:     "begin": {
993 // CHECK-NEXT:      "offset": 293,
994 // CHECK-NEXT:      "line": 26,
995 // CHECK-NEXT:      "col": 5,
996 // CHECK-NEXT:      "tokLen": 1
997 // CHECK-NEXT:     },
998 // CHECK-NEXT:     "end": {
999 // CHECK-NEXT:      "offset": 293,
1000 // CHECK-NEXT:      "col": 5,
1001 // CHECK-NEXT:      "tokLen": 1
1002 // CHECK-NEXT:     }
1003 // CHECK-NEXT:    }
1004 // CHECK-NEXT:   }
1005 // CHECK-NEXT:  ]
1006 // CHECK-NEXT: }
1007