1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -ast-dump=json %s | FileCheck %s
3 unsigned char implicitcast_0(unsigned int x
) {
7 signed char implicitcast_1(unsigned int x
) {
11 unsigned char implicitcast_2(signed int x
) {
15 signed char implicitcast_3(signed int x
) {
19 //----------------------------------------------------------------------------//
21 unsigned char cstylecast_0(unsigned int x
) {
22 return (unsigned char)x
;
25 signed char cstylecast_1(unsigned int x
) {
26 return (signed char)x
;
29 unsigned char cstylecast_2(signed int x
) {
30 return (unsigned char)x
;
33 signed char cstylecast_3(signed int x
) {
34 return (signed char)x
;
37 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
38 // using --filters=ImplicitCastExpr,CStyleCastExpr
40 // CHECK: "kind": "ImplicitCastExpr",
41 // CHECK-NEXT: "range": {
42 // CHECK-NEXT: "begin": {
43 // CHECK-NEXT: "offset": {{[0-9]+}},
44 // CHECK-NEXT: "col": 10,
45 // CHECK-NEXT: "tokLen": 1
47 // CHECK-NEXT: "end": {
48 // CHECK-NEXT: "offset": {{[0-9]+}},
49 // CHECK-NEXT: "col": 10,
50 // CHECK-NEXT: "tokLen": 1
53 // CHECK-NEXT: "type": {
54 // CHECK-NEXT: "qualType": "unsigned char"
56 // CHECK-NEXT: "valueCategory": "prvalue",
57 // CHECK-NEXT: "castKind": "IntegralCast",
58 // CHECK-NEXT: "inner": [
60 // CHECK-NEXT: "id": "0x{{.*}}",
61 // CHECK-NEXT: "kind": "ImplicitCastExpr",
62 // CHECK-NEXT: "range": {
63 // CHECK-NEXT: "begin": {
64 // CHECK-NEXT: "offset": {{[0-9]+}},
65 // CHECK-NEXT: "col": 10,
66 // CHECK-NEXT: "tokLen": 1
68 // CHECK-NEXT: "end": {
69 // CHECK-NEXT: "offset": {{[0-9]+}},
70 // CHECK-NEXT: "col": 10,
71 // CHECK-NEXT: "tokLen": 1
74 // CHECK-NEXT: "type": {
75 // CHECK-NEXT: "qualType": "unsigned int"
77 // CHECK-NEXT: "valueCategory": "prvalue",
78 // CHECK-NEXT: "castKind": "LValueToRValue",
79 // CHECK-NEXT: "inner": [
81 // CHECK-NEXT: "id": "0x{{.*}}",
82 // CHECK-NEXT: "kind": "DeclRefExpr",
83 // CHECK-NEXT: "range": {
84 // CHECK-NEXT: "begin": {
85 // CHECK-NEXT: "offset": {{[0-9]+}},
86 // CHECK-NEXT: "col": 10,
87 // CHECK-NEXT: "tokLen": 1
89 // CHECK-NEXT: "end": {
90 // CHECK-NEXT: "offset": {{[0-9]+}},
91 // CHECK-NEXT: "col": 10,
92 // CHECK-NEXT: "tokLen": 1
95 // CHECK-NEXT: "type": {
96 // CHECK-NEXT: "qualType": "unsigned int"
98 // CHECK-NEXT: "valueCategory": "lvalue",
99 // CHECK-NEXT: "referencedDecl": {
100 // CHECK-NEXT: "id": "0x{{.*}}",
101 // CHECK-NEXT: "kind": "ParmVarDecl",
102 // CHECK-NEXT: "name": "x",
103 // CHECK-NEXT: "type": {
104 // CHECK-NEXT: "qualType": "unsigned int"
113 // CHECK: "kind": "ImplicitCastExpr",
114 // CHECK-NEXT: "range": {
115 // CHECK-NEXT: "begin": {
116 // CHECK-NEXT: "offset": {{[0-9]+}},
117 // CHECK-NEXT: "col": 10,
118 // CHECK-NEXT: "tokLen": 1
120 // CHECK-NEXT: "end": {
121 // CHECK-NEXT: "offset": {{[0-9]+}},
122 // CHECK-NEXT: "col": 10,
123 // CHECK-NEXT: "tokLen": 1
126 // CHECK-NEXT: "type": {
127 // CHECK-NEXT: "qualType": "signed char"
129 // CHECK-NEXT: "valueCategory": "prvalue",
130 // CHECK-NEXT: "castKind": "IntegralCast",
131 // CHECK-NEXT: "inner": [
133 // CHECK-NEXT: "id": "0x{{.*}}",
134 // CHECK-NEXT: "kind": "ImplicitCastExpr",
135 // CHECK-NEXT: "range": {
136 // CHECK-NEXT: "begin": {
137 // CHECK-NEXT: "offset": {{[0-9]+}},
138 // CHECK-NEXT: "col": 10,
139 // CHECK-NEXT: "tokLen": 1
141 // CHECK-NEXT: "end": {
142 // CHECK-NEXT: "offset": {{[0-9]+}},
143 // CHECK-NEXT: "col": 10,
144 // CHECK-NEXT: "tokLen": 1
147 // CHECK-NEXT: "type": {
148 // CHECK-NEXT: "qualType": "unsigned int"
150 // CHECK-NEXT: "valueCategory": "prvalue",
151 // CHECK-NEXT: "castKind": "LValueToRValue",
152 // CHECK-NEXT: "inner": [
154 // CHECK-NEXT: "id": "0x{{.*}}",
155 // CHECK-NEXT: "kind": "DeclRefExpr",
156 // CHECK-NEXT: "range": {
157 // CHECK-NEXT: "begin": {
158 // CHECK-NEXT: "offset": {{[0-9]+}},
159 // CHECK-NEXT: "col": 10,
160 // CHECK-NEXT: "tokLen": 1
162 // CHECK-NEXT: "end": {
163 // CHECK-NEXT: "offset": {{[0-9]+}},
164 // CHECK-NEXT: "col": 10,
165 // CHECK-NEXT: "tokLen": 1
168 // CHECK-NEXT: "type": {
169 // CHECK-NEXT: "qualType": "unsigned int"
171 // CHECK-NEXT: "valueCategory": "lvalue",
172 // CHECK-NEXT: "referencedDecl": {
173 // CHECK-NEXT: "id": "0x{{.*}}",
174 // CHECK-NEXT: "kind": "ParmVarDecl",
175 // CHECK-NEXT: "name": "x",
176 // CHECK-NEXT: "type": {
177 // CHECK-NEXT: "qualType": "unsigned int"
186 // CHECK: "kind": "ImplicitCastExpr",
187 // CHECK-NEXT: "range": {
188 // CHECK-NEXT: "begin": {
189 // CHECK-NEXT: "offset": {{[0-9]+}},
190 // CHECK-NEXT: "col": 10,
191 // CHECK-NEXT: "tokLen": 1
193 // CHECK-NEXT: "end": {
194 // CHECK-NEXT: "offset": {{[0-9]+}},
195 // CHECK-NEXT: "col": 10,
196 // CHECK-NEXT: "tokLen": 1
199 // CHECK-NEXT: "type": {
200 // CHECK-NEXT: "qualType": "unsigned char"
202 // CHECK-NEXT: "valueCategory": "prvalue",
203 // CHECK-NEXT: "castKind": "IntegralCast",
204 // CHECK-NEXT: "inner": [
206 // CHECK-NEXT: "id": "0x{{.*}}",
207 // CHECK-NEXT: "kind": "ImplicitCastExpr",
208 // CHECK-NEXT: "range": {
209 // CHECK-NEXT: "begin": {
210 // CHECK-NEXT: "offset": {{[0-9]+}},
211 // CHECK-NEXT: "col": 10,
212 // CHECK-NEXT: "tokLen": 1
214 // CHECK-NEXT: "end": {
215 // CHECK-NEXT: "offset": {{[0-9]+}},
216 // CHECK-NEXT: "col": 10,
217 // CHECK-NEXT: "tokLen": 1
220 // CHECK-NEXT: "type": {
221 // CHECK-NEXT: "qualType": "int"
223 // CHECK-NEXT: "valueCategory": "prvalue",
224 // CHECK-NEXT: "castKind": "LValueToRValue",
225 // CHECK-NEXT: "inner": [
227 // CHECK-NEXT: "id": "0x{{.*}}",
228 // CHECK-NEXT: "kind": "DeclRefExpr",
229 // CHECK-NEXT: "range": {
230 // CHECK-NEXT: "begin": {
231 // CHECK-NEXT: "offset": {{[0-9]+}},
232 // CHECK-NEXT: "col": 10,
233 // CHECK-NEXT: "tokLen": 1
235 // CHECK-NEXT: "end": {
236 // CHECK-NEXT: "offset": {{[0-9]+}},
237 // CHECK-NEXT: "col": 10,
238 // CHECK-NEXT: "tokLen": 1
241 // CHECK-NEXT: "type": {
242 // CHECK-NEXT: "qualType": "int"
244 // CHECK-NEXT: "valueCategory": "lvalue",
245 // CHECK-NEXT: "referencedDecl": {
246 // CHECK-NEXT: "id": "0x{{.*}}",
247 // CHECK-NEXT: "kind": "ParmVarDecl",
248 // CHECK-NEXT: "name": "x",
249 // CHECK-NEXT: "type": {
250 // CHECK-NEXT: "qualType": "int"
259 // CHECK: "kind": "ImplicitCastExpr",
260 // CHECK-NEXT: "range": {
261 // CHECK-NEXT: "begin": {
262 // CHECK-NEXT: "offset": {{[0-9]+}},
263 // CHECK-NEXT: "col": 10,
264 // CHECK-NEXT: "tokLen": 1
266 // CHECK-NEXT: "end": {
267 // CHECK-NEXT: "offset": {{[0-9]+}},
268 // CHECK-NEXT: "col": 10,
269 // CHECK-NEXT: "tokLen": 1
272 // CHECK-NEXT: "type": {
273 // CHECK-NEXT: "qualType": "signed char"
275 // CHECK-NEXT: "valueCategory": "prvalue",
276 // CHECK-NEXT: "castKind": "IntegralCast",
277 // CHECK-NEXT: "inner": [
279 // CHECK-NEXT: "id": "0x{{.*}}",
280 // CHECK-NEXT: "kind": "ImplicitCastExpr",
281 // CHECK-NEXT: "range": {
282 // CHECK-NEXT: "begin": {
283 // CHECK-NEXT: "offset": {{[0-9]+}},
284 // CHECK-NEXT: "col": 10,
285 // CHECK-NEXT: "tokLen": 1
287 // CHECK-NEXT: "end": {
288 // CHECK-NEXT: "offset": {{[0-9]+}},
289 // CHECK-NEXT: "col": 10,
290 // CHECK-NEXT: "tokLen": 1
293 // CHECK-NEXT: "type": {
294 // CHECK-NEXT: "qualType": "int"
296 // CHECK-NEXT: "valueCategory": "prvalue",
297 // CHECK-NEXT: "castKind": "LValueToRValue",
298 // CHECK-NEXT: "inner": [
300 // CHECK-NEXT: "id": "0x{{.*}}",
301 // CHECK-NEXT: "kind": "DeclRefExpr",
302 // CHECK-NEXT: "range": {
303 // CHECK-NEXT: "begin": {
304 // CHECK-NEXT: "offset": {{[0-9]+}},
305 // CHECK-NEXT: "col": 10,
306 // CHECK-NEXT: "tokLen": 1
308 // CHECK-NEXT: "end": {
309 // CHECK-NEXT: "offset": {{[0-9]+}},
310 // CHECK-NEXT: "col": 10,
311 // CHECK-NEXT: "tokLen": 1
314 // CHECK-NEXT: "type": {
315 // CHECK-NEXT: "qualType": "int"
317 // CHECK-NEXT: "valueCategory": "lvalue",
318 // CHECK-NEXT: "referencedDecl": {
319 // CHECK-NEXT: "id": "0x{{.*}}",
320 // CHECK-NEXT: "kind": "ParmVarDecl",
321 // CHECK-NEXT: "name": "x",
322 // CHECK-NEXT: "type": {
323 // CHECK-NEXT: "qualType": "int"
332 // CHECK: "kind": "CStyleCastExpr",
333 // CHECK-NEXT: "range": {
334 // CHECK-NEXT: "begin": {
335 // CHECK-NEXT: "offset": {{[0-9]+}},
336 // CHECK-NEXT: "col": 10,
337 // CHECK-NEXT: "tokLen": 1
339 // CHECK-NEXT: "end": {
340 // CHECK-NEXT: "offset": {{[0-9]+}},
341 // CHECK-NEXT: "col": 25,
342 // CHECK-NEXT: "tokLen": 1
345 // CHECK-NEXT: "type": {
346 // CHECK-NEXT: "qualType": "unsigned char"
348 // CHECK-NEXT: "valueCategory": "prvalue",
349 // CHECK-NEXT: "castKind": "IntegralCast",
350 // CHECK-NEXT: "inner": [
352 // CHECK-NEXT: "id": "0x{{.*}}",
353 // CHECK-NEXT: "kind": "ImplicitCastExpr",
354 // CHECK-NEXT: "range": {
355 // CHECK-NEXT: "begin": {
356 // CHECK-NEXT: "offset": {{[0-9]+}},
357 // CHECK-NEXT: "col": 25,
358 // CHECK-NEXT: "tokLen": 1
360 // CHECK-NEXT: "end": {
361 // CHECK-NEXT: "offset": {{[0-9]+}},
362 // CHECK-NEXT: "col": 25,
363 // CHECK-NEXT: "tokLen": 1
366 // CHECK-NEXT: "type": {
367 // CHECK-NEXT: "qualType": "unsigned int"
369 // CHECK-NEXT: "valueCategory": "prvalue",
370 // CHECK-NEXT: "castKind": "LValueToRValue",
371 // CHECK-NEXT: "isPartOfExplicitCast": true,
372 // CHECK-NEXT: "inner": [
374 // CHECK-NEXT: "id": "0x{{.*}}",
375 // CHECK-NEXT: "kind": "DeclRefExpr",
376 // CHECK-NEXT: "range": {
377 // CHECK-NEXT: "begin": {
378 // CHECK-NEXT: "offset": {{[0-9]+}},
379 // CHECK-NEXT: "col": 25,
380 // CHECK-NEXT: "tokLen": 1
382 // CHECK-NEXT: "end": {
383 // CHECK-NEXT: "offset": {{[0-9]+}},
384 // CHECK-NEXT: "col": 25,
385 // CHECK-NEXT: "tokLen": 1
388 // CHECK-NEXT: "type": {
389 // CHECK-NEXT: "qualType": "unsigned int"
391 // CHECK-NEXT: "valueCategory": "lvalue",
392 // CHECK-NEXT: "referencedDecl": {
393 // CHECK-NEXT: "id": "0x{{.*}}",
394 // CHECK-NEXT: "kind": "ParmVarDecl",
395 // CHECK-NEXT: "name": "x",
396 // CHECK-NEXT: "type": {
397 // CHECK-NEXT: "qualType": "unsigned int"
406 // CHECK: "kind": "CStyleCastExpr",
407 // CHECK-NEXT: "range": {
408 // CHECK-NEXT: "begin": {
409 // CHECK-NEXT: "offset": {{[0-9]+}},
410 // CHECK-NEXT: "col": 10,
411 // CHECK-NEXT: "tokLen": 1
413 // CHECK-NEXT: "end": {
414 // CHECK-NEXT: "offset": {{[0-9]+}},
415 // CHECK-NEXT: "col": 23,
416 // CHECK-NEXT: "tokLen": 1
419 // CHECK-NEXT: "type": {
420 // CHECK-NEXT: "qualType": "signed char"
422 // CHECK-NEXT: "valueCategory": "prvalue",
423 // CHECK-NEXT: "castKind": "IntegralCast",
424 // CHECK-NEXT: "inner": [
426 // CHECK-NEXT: "id": "0x{{.*}}",
427 // CHECK-NEXT: "kind": "ImplicitCastExpr",
428 // CHECK-NEXT: "range": {
429 // CHECK-NEXT: "begin": {
430 // CHECK-NEXT: "offset": {{[0-9]+}},
431 // CHECK-NEXT: "col": 23,
432 // CHECK-NEXT: "tokLen": 1
434 // CHECK-NEXT: "end": {
435 // CHECK-NEXT: "offset": {{[0-9]+}},
436 // CHECK-NEXT: "col": 23,
437 // CHECK-NEXT: "tokLen": 1
440 // CHECK-NEXT: "type": {
441 // CHECK-NEXT: "qualType": "unsigned int"
443 // CHECK-NEXT: "valueCategory": "prvalue",
444 // CHECK-NEXT: "castKind": "LValueToRValue",
445 // CHECK-NEXT: "isPartOfExplicitCast": true,
446 // CHECK-NEXT: "inner": [
448 // CHECK-NEXT: "id": "0x{{.*}}",
449 // CHECK-NEXT: "kind": "DeclRefExpr",
450 // CHECK-NEXT: "range": {
451 // CHECK-NEXT: "begin": {
452 // CHECK-NEXT: "offset": {{[0-9]+}},
453 // CHECK-NEXT: "col": 23,
454 // CHECK-NEXT: "tokLen": 1
456 // CHECK-NEXT: "end": {
457 // CHECK-NEXT: "offset": {{[0-9]+}},
458 // CHECK-NEXT: "col": 23,
459 // CHECK-NEXT: "tokLen": 1
462 // CHECK-NEXT: "type": {
463 // CHECK-NEXT: "qualType": "unsigned int"
465 // CHECK-NEXT: "valueCategory": "lvalue",
466 // CHECK-NEXT: "referencedDecl": {
467 // CHECK-NEXT: "id": "0x{{.*}}",
468 // CHECK-NEXT: "kind": "ParmVarDecl",
469 // CHECK-NEXT: "name": "x",
470 // CHECK-NEXT: "type": {
471 // CHECK-NEXT: "qualType": "unsigned int"
480 // CHECK: "kind": "CStyleCastExpr",
481 // CHECK-NEXT: "range": {
482 // CHECK-NEXT: "begin": {
483 // CHECK-NEXT: "offset": {{[0-9]+}},
484 // CHECK-NEXT: "col": 10,
485 // CHECK-NEXT: "tokLen": 1
487 // CHECK-NEXT: "end": {
488 // CHECK-NEXT: "offset": {{[0-9]+}},
489 // CHECK-NEXT: "col": 25,
490 // CHECK-NEXT: "tokLen": 1
493 // CHECK-NEXT: "type": {
494 // CHECK-NEXT: "qualType": "unsigned char"
496 // CHECK-NEXT: "valueCategory": "prvalue",
497 // CHECK-NEXT: "castKind": "IntegralCast",
498 // CHECK-NEXT: "inner": [
500 // CHECK-NEXT: "id": "0x{{.*}}",
501 // CHECK-NEXT: "kind": "ImplicitCastExpr",
502 // CHECK-NEXT: "range": {
503 // CHECK-NEXT: "begin": {
504 // CHECK-NEXT: "offset": {{[0-9]+}},
505 // CHECK-NEXT: "col": 25,
506 // CHECK-NEXT: "tokLen": 1
508 // CHECK-NEXT: "end": {
509 // CHECK-NEXT: "offset": {{[0-9]+}},
510 // CHECK-NEXT: "col": 25,
511 // CHECK-NEXT: "tokLen": 1
514 // CHECK-NEXT: "type": {
515 // CHECK-NEXT: "qualType": "int"
517 // CHECK-NEXT: "valueCategory": "prvalue",
518 // CHECK-NEXT: "castKind": "LValueToRValue",
519 // CHECK-NEXT: "isPartOfExplicitCast": true,
520 // CHECK-NEXT: "inner": [
522 // CHECK-NEXT: "id": "0x{{.*}}",
523 // CHECK-NEXT: "kind": "DeclRefExpr",
524 // CHECK-NEXT: "range": {
525 // CHECK-NEXT: "begin": {
526 // CHECK-NEXT: "offset": {{[0-9]+}},
527 // CHECK-NEXT: "col": 25,
528 // CHECK-NEXT: "tokLen": 1
530 // CHECK-NEXT: "end": {
531 // CHECK-NEXT: "offset": {{[0-9]+}},
532 // CHECK-NEXT: "col": 25,
533 // CHECK-NEXT: "tokLen": 1
536 // CHECK-NEXT: "type": {
537 // CHECK-NEXT: "qualType": "int"
539 // CHECK-NEXT: "valueCategory": "lvalue",
540 // CHECK-NEXT: "referencedDecl": {
541 // CHECK-NEXT: "id": "0x{{.*}}",
542 // CHECK-NEXT: "kind": "ParmVarDecl",
543 // CHECK-NEXT: "name": "x",
544 // CHECK-NEXT: "type": {
545 // CHECK-NEXT: "qualType": "int"
554 // CHECK: "kind": "CStyleCastExpr",
555 // CHECK-NEXT: "range": {
556 // CHECK-NEXT: "begin": {
557 // CHECK-NEXT: "offset": {{[0-9]+}},
558 // CHECK-NEXT: "col": 10,
559 // CHECK-NEXT: "tokLen": 1
561 // CHECK-NEXT: "end": {
562 // CHECK-NEXT: "offset": {{[0-9]+}},
563 // CHECK-NEXT: "col": 23,
564 // CHECK-NEXT: "tokLen": 1
567 // CHECK-NEXT: "type": {
568 // CHECK-NEXT: "qualType": "signed char"
570 // CHECK-NEXT: "valueCategory": "prvalue",
571 // CHECK-NEXT: "castKind": "IntegralCast",
572 // CHECK-NEXT: "inner": [
574 // CHECK-NEXT: "id": "0x{{.*}}",
575 // CHECK-NEXT: "kind": "ImplicitCastExpr",
576 // CHECK-NEXT: "range": {
577 // CHECK-NEXT: "begin": {
578 // CHECK-NEXT: "offset": {{[0-9]+}},
579 // CHECK-NEXT: "col": 23,
580 // CHECK-NEXT: "tokLen": 1
582 // CHECK-NEXT: "end": {
583 // CHECK-NEXT: "offset": {{[0-9]+}},
584 // CHECK-NEXT: "col": 23,
585 // CHECK-NEXT: "tokLen": 1
588 // CHECK-NEXT: "type": {
589 // CHECK-NEXT: "qualType": "int"
591 // CHECK-NEXT: "valueCategory": "prvalue",
592 // CHECK-NEXT: "castKind": "LValueToRValue",
593 // CHECK-NEXT: "isPartOfExplicitCast": true,
594 // CHECK-NEXT: "inner": [
596 // CHECK-NEXT: "id": "0x{{.*}}",
597 // CHECK-NEXT: "kind": "DeclRefExpr",
598 // CHECK-NEXT: "range": {
599 // CHECK-NEXT: "begin": {
600 // CHECK-NEXT: "offset": {{[0-9]+}},
601 // CHECK-NEXT: "col": 23,
602 // CHECK-NEXT: "tokLen": 1
604 // CHECK-NEXT: "end": {
605 // CHECK-NEXT: "offset": {{[0-9]+}},
606 // CHECK-NEXT: "col": 23,
607 // CHECK-NEXT: "tokLen": 1
610 // CHECK-NEXT: "type": {
611 // CHECK-NEXT: "qualType": "int"
613 // CHECK-NEXT: "valueCategory": "lvalue",
614 // CHECK-NEXT: "referencedDecl": {
615 // CHECK-NEXT: "id": "0x{{.*}}",
616 // CHECK-NEXT: "kind": "ParmVarDecl",
617 // CHECK-NEXT: "name": "x",
618 // CHECK-NEXT: "type": {
619 // CHECK-NEXT: "qualType": "int"