@@ -384,17 +384,12 @@ void goto_convertt::convert_switch_case(
384
384
}
385
385
386
386
void goto_convertt::convert_gcc_switch_case_range (
387
- const codet &code,
387
+ const code_gcc_switch_case_ranget &code,
388
388
goto_programt &dest,
389
389
const irep_idt &mode)
390
390
{
391
- INVARIANT_WITH_DIAGNOSTICS (
392
- code.operands ().size () == 3 ,
393
- " GCC's switch-case-range statement expected to have three operands" ,
394
- code.find_source_location ());
395
-
396
- const auto lb = numeric_cast<mp_integer>(code.op0 ());
397
- const auto ub = numeric_cast<mp_integer>(code.op1 ());
391
+ const auto lb = numeric_cast<mp_integer>(code.lower ());
392
+ const auto ub = numeric_cast<mp_integer>(code.upper ());
398
393
399
394
INVARIANT_WITH_DIAGNOSTICS (
400
395
lb.has_value () && ub.has_value (),
@@ -409,7 +404,7 @@ void goto_convertt::convert_gcc_switch_case_range(
409
404
}
410
405
411
406
goto_programt tmp;
412
- convert (to_code ( code.op2 () ), tmp, mode);
407
+ convert (code.code ( ), tmp, mode);
413
408
414
409
goto_programt::targett target = tmp.instructions .begin ();
415
410
dest.destructive_append (tmp);
@@ -425,7 +420,7 @@ void goto_convertt::convert_gcc_switch_case_range(
425
420
exprt::operandst &case_op_dest = cases_entry->second ->second ;
426
421
427
422
for (mp_integer i = *lb; i <= *ub; ++i)
428
- case_op_dest.push_back (from_integer (i, code.op0 ().type ()));
423
+ case_op_dest.push_back (from_integer (i, code.lower ().type ()));
429
424
}
430
425
431
426
// / converts 'code' and appends the result to 'dest'
@@ -459,7 +454,8 @@ void goto_convertt::convert(
459
454
else if (statement==ID_switch_case)
460
455
convert_switch_case (to_code_switch_case (code), dest, mode);
461
456
else if (statement==ID_gcc_switch_case_range)
462
- convert_gcc_switch_case_range (code, dest, mode);
457
+ convert_gcc_switch_case_range (
458
+ to_code_gcc_switch_case_range (code), dest, mode);
463
459
else if (statement==ID_for)
464
460
convert_for (to_code_for (code), dest, mode);
465
461
else if (statement==ID_while)
0 commit comments