@@ -1462,11 +1462,6 @@ void code_contractst::add_contract_check(
1462
1462
// assert(ensures)
1463
1463
// skip: ...
1464
1464
1465
- // build skip so that if(nondet) can refer to it
1466
- goto_programt tmp_skip;
1467
- goto_programt::targett skip =
1468
- tmp_skip.add (goto_programt::make_skip (ensures.source_location ()));
1469
-
1470
1465
goto_programt check;
1471
1466
1472
1467
// prepare function call including all declarations
@@ -1478,17 +1473,19 @@ void code_contractst::add_contract_check(
1478
1473
// This object tracks replacements that are common to ENSURES and REQUIRES.
1479
1474
replace_symbolt common_replace;
1480
1475
1476
+ const auto &source_location = function_symbol.location ;
1477
+
1481
1478
// decl ret
1482
1479
optionalt<code_returnt> return_stmt;
1483
1480
if (code_type.return_type () != empty_typet ())
1484
1481
{
1485
1482
symbol_exprt r = new_tmp_symbol (
1486
1483
code_type.return_type (),
1487
- skip-> source_location () ,
1484
+ source_location,
1488
1485
function_symbol.mode ,
1489
1486
symbol_table)
1490
1487
.symbol_expr ();
1491
- check.add (goto_programt::make_decl (r, skip-> source_location () ));
1488
+ check.add (goto_programt::make_decl (r, source_location));
1492
1489
1493
1490
call.lhs () = r;
1494
1491
return_stmt = code_returnt (r);
@@ -1509,13 +1506,13 @@ void code_contractst::add_contract_check(
1509
1506
const symbolt ¶meter_symbol = ns.lookup (parameter);
1510
1507
symbol_exprt p = new_tmp_symbol (
1511
1508
parameter_symbol.type ,
1512
- skip-> source_location () ,
1509
+ source_location,
1513
1510
parameter_symbol.mode ,
1514
1511
symbol_table)
1515
1512
.symbol_expr ();
1516
- check.add (goto_programt::make_decl (p, skip-> source_location () ));
1513
+ check.add (goto_programt::make_decl (p, source_location));
1517
1514
check.add (goto_programt::make_assignment (
1518
- p, parameter_symbol.symbol_expr (), skip-> source_location () ));
1515
+ p, parameter_symbol.symbol_expr (), source_location));
1519
1516
1520
1517
call.arguments ().push_back (p);
1521
1518
@@ -1577,7 +1574,7 @@ void code_contractst::add_contract_check(
1577
1574
}
1578
1575
1579
1576
// ret=mangled_function(parameter1, ...)
1580
- check.add (goto_programt::make_function_call (call, skip-> source_location () ));
1577
+ check.add (goto_programt::make_function_call (call, source_location));
1581
1578
1582
1579
// Generate: assert(ensures)
1583
1580
if (ensures.is_not_nil ())
@@ -1598,15 +1595,12 @@ void code_contractst::add_contract_check(
1598
1595
if (code_type.return_type () != empty_typet ())
1599
1596
{
1600
1597
check.add (goto_programt::make_set_return_value (
1601
- return_stmt.value ().return_value (), skip-> source_location () ));
1598
+ return_stmt.value ().return_value (), source_location));
1602
1599
}
1603
1600
1604
1601
// kill the is_fresh memory map
1605
1602
visitor.add_memory_map_dead (check);
1606
1603
1607
- // add final instruction
1608
- check.destructive_append (tmp_skip);
1609
-
1610
1604
// prepend the new code to dest
1611
1605
dest.destructive_insert (dest.instructions .begin (), check);
1612
1606
0 commit comments