Skip to content

Commit 7d64d7e

Browse files
author
Daniel Kroening
committed
prefer .add over .emplace
1 parent cb9ed32 commit 7d64d7e

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

unit/goto-programs/goto_program_assume.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ SCENARIO(
3131
binary_relation_exprt x_le_10(varx, ID_le, val10);
3232

3333
goto_functiont goto_function;
34-
auto &instructions = goto_function.body.instructions;
35-
instructions.emplace_back(goto_program_instruction_typet::ASSUME);
34+
auto assertion = goto_function.body.add(goto_programt::make_assertion(x_le_10));
3635

3736
symbol.type = type1;
3837
symbol_table.insert(symbol);
3938
symbol_table.insert(fun_symbol);
4039
namespacet ns(symbol_table);
41-
instructions.back() = goto_programt::make_assertion(x_le_10);
4240

4341
WHEN("Instruction has no targets")
4442
{
@@ -51,7 +49,7 @@ SCENARIO(
5149

5250
WHEN("Instruction has a target")
5351
{
54-
instructions.back().targets.push_back(instructions.begin());
52+
assertion->targets.push_back(assertion);
5553
THEN("The consistency check fails")
5654
{
5755
REQUIRE_THROWS_AS(

unit/goto-programs/goto_program_declaration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ SCENARIO(
3232
symbol_exprt var_a(var_symbol_name, type1);
3333

3434
goto_functiont goto_function;
35-
auto &instructions = goto_function.body.instructions;
36-
instructions.emplace_back(goto_programt::make_decl(var_a));
35+
goto_function.body.add(goto_programt::make_decl(var_a));
3736
symbol_table.insert(fun_symbol);
3837

3938
WHEN("Declaring known symbol")

0 commit comments

Comments
 (0)