Skip to content

Commit 8f01ac2

Browse files
author
Daniel Kroening
committed
prefer .add over .emplace
1 parent 9558bd1 commit 8f01ac2

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

unit/goto-programs/goto_program_assume.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ 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 =
35+
goto_function.body.add(goto_programt::make_assertion(x_le_10));
3636

3737
symbol.type = type1;
3838
symbol_table.insert(symbol);
3939
symbol_table.insert(fun_symbol);
4040
namespacet ns(symbol_table);
41-
instructions.back() = goto_programt::make_assertion(x_le_10);
4241

4342
WHEN("Instruction has no targets")
4443
{
@@ -51,7 +50,7 @@ SCENARIO(
5150

5251
WHEN("Instruction has a target")
5352
{
54-
instructions.back().targets.push_back(instructions.begin());
53+
assertion->targets.push_back(assertion);
5554
THEN("The consistency check fails")
5655
{
5756
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)