@@ -298,9 +298,8 @@ void goto_convertt::copy(
298
298
goto_program_instruction_typet type,
299
299
goto_programt &dest)
300
300
{
301
- goto_programt::targett t=dest.add_instruction (type);
302
- t->code =code;
303
- t->source_location =code.source_location ();
301
+ dest.add (goto_programt::instructiont (
302
+ code, code.source_location (), type, nil_exprt (), {}));
304
303
}
305
304
306
305
void goto_convertt::convert_label (
@@ -827,9 +826,8 @@ void goto_convertt::convert_skip(
827
826
const codet &code,
828
827
goto_programt &dest)
829
828
{
830
- goto_programt::targett t=dest.add_instruction (SKIP);
831
- t->source_location =code.source_location ();
832
- t->code =code;
829
+ dest.add (goto_programt::instructiont (
830
+ code, code.source_location (), SKIP, nil_exprt (), {}));
833
831
}
834
832
835
833
void goto_convertt::convert_assume (
@@ -900,7 +898,7 @@ void goto_convertt::convert_for(
900
898
901
899
// do the v label
902
900
goto_programt tmp_v;
903
- goto_programt::targett v= tmp_v.add_instruction ( );
901
+ goto_programt::targett v = tmp_v.add ( goto_programt::instructiont () );
904
902
905
903
// do the z label
906
904
goto_programt tmp_z;
@@ -990,9 +988,10 @@ void goto_convertt::convert_while(
990
988
// do the v label
991
989
goto_programt::targett v=tmp_branch.instructions .begin ();
992
990
993
- // do the y label
991
+ // y: goto v;
994
992
goto_programt tmp_y;
995
- goto_programt::targett y=tmp_y.add_instruction ();
993
+ goto_programt::targett y = tmp_y.add (
994
+ goto_programt::make_goto (v, true_exprt (), code.source_location ()));
996
995
997
996
// set the targets
998
997
targets.set_break (z);
@@ -1002,9 +1001,6 @@ void goto_convertt::convert_while(
1002
1001
goto_programt tmp_x;
1003
1002
convert (code.body (), tmp_x, mode);
1004
1003
1005
- // y: if(c) goto v;
1006
- *y = goto_programt::make_goto (v, true_exprt (), code.source_location ());
1007
-
1008
1004
// loop invariant
1009
1005
convert_loop_invariant (code, y, mode);
1010
1006
@@ -1047,7 +1043,8 @@ void goto_convertt::convert_dowhile(
1047
1043
1048
1044
// do the y label
1049
1045
goto_programt tmp_y;
1050
- goto_programt::targett y=tmp_y.add_instruction ();
1046
+ goto_programt::targett y =
1047
+ tmp_y.add (goto_programt::make_incomplete_goto (cond, condition_location));
1051
1048
1052
1049
// do the z label
1053
1050
goto_programt tmp_z;
@@ -1071,7 +1068,7 @@ void goto_convertt::convert_dowhile(
1071
1068
goto_programt::targett w=tmp_w.instructions .begin ();
1072
1069
1073
1070
// y: if(c) goto w;
1074
- *y = goto_programt::make_goto (w, cond, condition_location );
1071
+ y-> complete_goto (w );
1075
1072
1076
1073
// loop invariant
1077
1074
convert_loop_invariant (code, y, mode);
@@ -1315,9 +1312,8 @@ void goto_convertt::convert_gcc_computed_goto(
1315
1312
goto_programt &dest)
1316
1313
{
1317
1314
// this instruction will turn into OTHER during post-processing
1318
- goto_programt::targett t=dest.add_instruction (NO_INSTRUCTION_TYPE);
1319
- t->source_location =code.source_location ();
1320
- t->code =code;
1315
+ goto_programt::targett t = dest.add (goto_programt::instructiont (
1316
+ code, code.source_location (), NO_INSTRUCTION_TYPE, nil_exprt (), {}));
1321
1317
1322
1318
// remember it to do this later
1323
1319
targets.computed_gotos .push_back (t);
@@ -1327,10 +1323,8 @@ void goto_convertt::convert_start_thread(
1327
1323
const codet &code,
1328
1324
goto_programt &dest)
1329
1325
{
1330
- goto_programt::targett start_thread=
1331
- dest.add_instruction (START_THREAD);
1332
- start_thread->source_location =code.source_location ();
1333
- start_thread->code =code;
1326
+ goto_programt::targett start_thread = dest.add (goto_programt::instructiont (
1327
+ code, code.source_location (), START_THREAD, nil_exprt (), {}));
1334
1328
1335
1329
// remember it to do target later
1336
1330
targets.gotos .emplace_back (
@@ -1543,7 +1537,8 @@ void goto_convertt::generate_ifthenelse(
1543
1537
1544
1538
// do the x label
1545
1539
goto_programt tmp_x;
1546
- goto_programt::targett x=tmp_x.add_instruction ();
1540
+ goto_programt::targett x =
1541
+ tmp_x.add (goto_programt::make_incomplete_goto (true_exprt ()));
1547
1542
1548
1543
// do the z label
1549
1544
goto_programt tmp_z;
@@ -1571,8 +1566,8 @@ void goto_convertt::generate_ifthenelse(
1571
1566
1572
1567
// x: goto z;
1573
1568
CHECK_RETURN (!tmp_w.instructions .empty ());
1574
- *x = goto_programt::make_goto (
1575
- z, true_exprt (), tmp_w.instructions .back ().source_location ) ;
1569
+ x-> complete_goto (z);
1570
+ x-> source_location = tmp_w.instructions .back ().source_location ;
1576
1571
1577
1572
dest.destructive_append (tmp_v);
1578
1573
dest.destructive_append (tmp_w);
@@ -1894,13 +1889,21 @@ void goto_convertt::generate_thread_block(
1894
1889
goto_programt::targett c = body.add (goto_programt::make_skip ());
1895
1890
convert (thread_body, body, mode);
1896
1891
1897
- goto_programt::targett e=postamble.add_instruction (END_THREAD);
1892
+ goto_programt::targett e = postamble.add (goto_programt::instructiont (
1893
+ static_cast <const codet &>(get_nil_irep ()),
1894
+ thread_body.source_location (),
1895
+ END_THREAD,
1896
+ nil_exprt (),
1897
+ {}));
1898
1898
e->source_location =thread_body.source_location ();
1899
1899
goto_programt::targett z = postamble.add (goto_programt::make_skip ());
1900
1900
1901
- goto_programt::targett a=preamble.add_instruction (START_THREAD);
1902
- a->source_location =thread_body.source_location ();
1903
- a->targets .push_back (c);
1901
+ preamble.add (goto_programt::instructiont (
1902
+ static_cast <const codet &>(get_nil_irep ()),
1903
+ thread_body.source_location (),
1904
+ START_THREAD,
1905
+ nil_exprt (),
1906
+ {c}));
1904
1907
preamble.add (goto_programt::make_goto (z, thread_body.source_location ()));
1905
1908
1906
1909
dest.destructive_append (preamble);
0 commit comments