Skip to content

Commit 9e0c5a3

Browse files
Daniel Kroeningtautschnig
Daniel Kroening
authored andcommitted
remove the trivial constructor from symex_targett::sourcet
sourcet contains an interator, and the current interface explicitly allows it to be uninitialised. However, most parts of the code base access source.pc without checking. This commit removes the option to leave the source uninitialized.
1 parent 4302619 commit 9e0c5a3

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/goto-symex/symex_target.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ class symex_targett
3939
// The program counter is an iterator which indicates where the execution
4040
// is in its program sequence
4141
goto_programt::const_targett pc;
42-
bool is_set;
43-
44-
sourcet() : thread_nr(0), function_id(irep_idt()), is_set(false)
45-
{
46-
}
4742

4843
sourcet(const irep_idt &_function_id, goto_programt::const_targett _pc)
49-
: thread_nr(0), function_id(_function_id), pc(_pc), is_set(true)
44+
: thread_nr(0), function_id(_function_id), pc(_pc)
5045
{
5146
}
5247

@@ -55,8 +50,7 @@ class symex_targett
5550
const goto_programt &_goto_program)
5651
: thread_nr(0),
5752
function_id(_function_id),
58-
pc(_goto_program.instructions.begin()),
59-
is_set(true)
53+
pc(_goto_program.instructions.begin())
6054
{
6155
}
6256
};

unit/goto-symex/ssa_equation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ SCENARIO("Validation of well-formed SSA steps", "[core][goto-symex][validate]")
2525
fun_symbol.name = fun_name;
2626
symbol_exprt fun_foo(fun_name, code_type);
2727

28+
goto_programt goto_program;
29+
goto_program.add_instruction(END_FUNCTION);
2830
symex_target_equationt equation;
29-
symex_targett::sourcet empty_source;
31+
symex_targett::sourcet at_end_function(fun_name, goto_program);
3032
equation.SSA_steps.emplace_back(
31-
empty_source, goto_trace_stept::typet::FUNCTION_RETURN);
33+
at_end_function, goto_trace_stept::typet::FUNCTION_RETURN);
3234
auto &step = equation.SSA_steps.back();
3335
step.called_function = fun_name;
3436

0 commit comments

Comments
 (0)