@@ -187,14 +187,14 @@ class code_blockt:public codet
187
187
return result;
188
188
}
189
189
190
- explicit code_blockt (const std::vector<codet> &_statements):codet(ID_block)
190
+ explicit code_blockt (const std::vector<codet> &_statements)
191
+ : codet(ID_block, (const std::vector<exprt> &)_statements)
191
192
{
192
- operands ()=(const std::vector<exprt> &)_statements;
193
193
}
194
194
195
- explicit code_blockt (std::vector<codet> &&_statements):codet(ID_block)
195
+ explicit code_blockt (std::vector<codet> &&_statements)
196
+ : codet(ID_block, std::move((std::vector<exprt> &&) _statements))
196
197
{
197
- operands ()=std::move ((std::vector<exprt> &&)_statements);
198
198
}
199
199
200
200
void add (const codet &code)
@@ -272,9 +272,9 @@ class code_assignt:public codet
272
272
operands ().resize (2 );
273
273
}
274
274
275
- code_assignt (const exprt &lhs, const exprt &rhs):codet(ID_assign)
275
+ code_assignt (const exprt &lhs, const exprt &rhs)
276
+ : codet(ID_assign, {lhs, rhs})
276
277
{
277
- add_to_operands (lhs, rhs);
278
278
}
279
279
280
280
exprt &lhs ()
@@ -435,9 +435,8 @@ inline code_declt &to_code_decl(codet &code)
435
435
class code_deadt :public codet
436
436
{
437
437
public:
438
- explicit code_deadt (const symbol_exprt &symbol) : codet(ID_dead)
438
+ explicit code_deadt (const symbol_exprt &symbol) : codet(ID_dead, {symbol} )
439
439
{
440
- add_to_operands (symbol);
441
440
}
442
441
443
442
symbol_exprt &symbol ()
@@ -513,9 +512,8 @@ class code_assumet:public codet
513
512
operands ().resize (1 );
514
513
}
515
514
516
- explicit code_assumet (const exprt &expr): codet(ID_assume)
515
+ explicit code_assumet (const exprt &expr) : codet(ID_assume, {expr} )
517
516
{
518
- add_to_operands (expr);
519
517
}
520
518
521
519
const exprt &assumption () const
@@ -565,9 +563,8 @@ class code_assertt:public codet
565
563
operands ().resize (1 );
566
564
}
567
565
568
- explicit code_assertt (const exprt &expr): codet(ID_assert)
566
+ explicit code_assertt (const exprt &expr) : codet(ID_assert, {expr} )
569
567
{
570
- add_to_operands (expr);
571
568
}
572
569
573
570
const exprt &assertion () const
@@ -638,16 +635,14 @@ class code_ifthenelset:public codet
638
635
const exprt &condition,
639
636
const codet &then_code,
640
637
const codet &else_code)
641
- : codet(ID_ifthenelse)
638
+ : codet(ID_ifthenelse, {condition, then_code, else_code} )
642
639
{
643
- add_to_operands (condition, then_code, else_code);
644
640
}
645
641
646
642
// / An if \p condition then \p then_code statement (no "else" case).
647
643
code_ifthenelset (const exprt &condition, const codet &then_code)
648
- : codet(ID_ifthenelse)
644
+ : codet(ID_ifthenelse, {condition, then_code, nil_exprt ()} )
649
645
{
650
- add_to_operands (condition, then_code, nil_exprt ());
651
646
}
652
647
653
648
const exprt &cond () const
@@ -722,11 +717,9 @@ class code_switcht:public codet
722
717
operands ().resize (2 );
723
718
}
724
719
725
- code_switcht (const exprt &_value, const codet &_body) : codet(ID_switch)
720
+ code_switcht (const exprt &_value, const codet &_body)
721
+ : codet(ID_switch, {_value, _body})
726
722
{
727
- operands ().resize (2 );
728
- value () = _value;
729
- body () = _body;
730
723
}
731
724
732
725
const exprt &value () const
@@ -784,11 +777,9 @@ class code_whilet:public codet
784
777
operands ().resize (2 );
785
778
}
786
779
787
- code_whilet (const exprt &_cond, const codet &_body) : codet(ID_while)
780
+ code_whilet (const exprt &_cond, const codet &_body)
781
+ : codet(ID_while, {_cond, _body})
788
782
{
789
- operands ().resize (2 );
790
- cond () = _cond;
791
- body () = _body;
792
783
}
793
784
794
785
const exprt &cond () const
@@ -846,11 +837,9 @@ class code_dowhilet:public codet
846
837
operands ().resize (2 );
847
838
}
848
839
849
- code_dowhilet (const exprt &_cond, const codet &_body) : codet(ID_dowhile)
840
+ code_dowhilet (const exprt &_cond, const codet &_body)
841
+ : codet(ID_dowhile, {_cond, _body})
850
842
{
851
- operands ().resize (2 );
852
- cond () = _cond;
853
- body () = _body;
854
843
}
855
844
856
845
const exprt &cond () const
@@ -917,11 +906,8 @@ class code_fort:public codet
917
906
const exprt &_cond,
918
907
const exprt &_iter,
919
908
const codet &_body)
920
- : codet(ID_for)
909
+ : codet(ID_for, {_init, _cond, _iter, _body} )
921
910
{
922
- reserve_operands (4 );
923
- add_to_operands (_init, _cond, _iter);
924
- add_to_operands (_body);
925
911
}
926
912
927
913
// nil or a statement
@@ -1203,9 +1189,8 @@ class code_returnt:public codet
1203
1189
op0 ().make_nil ();
1204
1190
}
1205
1191
1206
- explicit code_returnt (const exprt &_op): codet(ID_return)
1192
+ explicit code_returnt (const exprt &_op) : codet(ID_return, {_op} )
1207
1193
{
1208
- add_to_operands (_op);
1209
1194
}
1210
1195
1211
1196
const exprt &return_value () const
@@ -1275,12 +1260,10 @@ class code_labelt:public codet
1275
1260
set_label (_label);
1276
1261
}
1277
1262
1278
- code_labelt (
1279
- const irep_idt &_label, const codet &_code):codet (ID_label)
1263
+ code_labelt (const irep_idt &_label, const codet &_code)
1264
+ : codet(ID_label, {_code} )
1280
1265
{
1281
- operands ().resize (1 );
1282
1266
set_label (_label);
1283
- code ()=_code;
1284
1267
}
1285
1268
1286
1269
const irep_idt &get_label () const
@@ -1339,10 +1322,9 @@ class code_switch_caset:public codet
1339
1322
operands ().resize (2 );
1340
1323
}
1341
1324
1342
- code_switch_caset (
1343
- const exprt & _case_op, const codet & _code):codet(ID_switch_case )
1325
+ code_switch_caset (const exprt &_case_op, const codet &_code)
1326
+ : codet(ID_switch_case, { _case_op, _code} )
1344
1327
{
1345
- add_to_operands (_case_op, _code);
1346
1328
}
1347
1329
1348
1330
bool is_default () const
@@ -1470,9 +1452,8 @@ class code_asmt:public codet
1470
1452
{
1471
1453
}
1472
1454
1473
- explicit code_asmt (const exprt &expr): codet(ID_asm)
1455
+ explicit code_asmt (const exprt &expr) : codet(ID_asm, {expr} )
1474
1456
{
1475
- add_to_operands (expr);
1476
1457
}
1477
1458
1478
1459
const irep_idt &get_flavor () const
@@ -1517,9 +1498,8 @@ class code_expressiont:public codet
1517
1498
operands ().resize (1 );
1518
1499
}
1519
1500
1520
- explicit code_expressiont (const exprt &expr): codet(ID_expression)
1501
+ explicit code_expressiont (const exprt &expr) : codet(ID_expression, {expr} )
1521
1502
{
1522
- add_to_operands (expr);
1523
1503
}
1524
1504
1525
1505
const exprt &expression () const
@@ -2117,9 +2097,9 @@ class code_try_catcht:public codet
2117
2097
}
2118
2098
2119
2099
// / A statement representing try \p _try_code catch ...
2120
- explicit code_try_catcht (const codet &_try_code) : codet(ID_try_catch)
2100
+ explicit code_try_catcht (const codet &_try_code)
2101
+ : codet(ID_try_catch, {_try_code})
2121
2102
{
2122
- add_to_operands (_try_code);
2123
2103
}
2124
2104
2125
2105
codet &try_code ()
0 commit comments