Skip to content

Commit 622940c

Browse files
committed
Replace goto_symext::options with const members
goto_symext no longer has a reference to a optionst object. Instead, the options that goto_symext needs to read from an optionst are read during construction and cached in const members.
1 parent 2ef8499 commit 622940c

File tree

9 files changed

+20
-27
lines changed

9 files changed

+20
-27
lines changed

src/goto-symex/goto_symex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ unsigned goto_symext::dynamic_counter=0;
1818

1919
void goto_symext::do_simplify(exprt &expr)
2020
{
21-
if(options.get_bool_option("simplify"))
21+
if(simplify_opt)
2222
simplify(expr, ns);
2323
}
2424

src/goto-symex/goto_symex.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class goto_symext
5555
const optionst &options,
5656
path_storaget &path_storage)
5757
: should_pause_symex(false),
58-
options(options),
5958
max_depth(options.get_unsigned_int_option("depth")),
6059
doing_path_exploration(options.is_set("paths")),
6160
allow_pointer_unsoundness(
@@ -64,6 +63,10 @@ class goto_symext
6463
constant_propagation(options.get_bool_option("propagation")),
6564
self_loops_to_assumptions(
6665
options.get_bool_option("self-loops-to-assumptions")),
66+
simplify_opt(options.get_bool_option("simplify")),
67+
unwinding_assertions(options.get_bool_option("unwinding-assertions")),
68+
partial_loops(options.get_bool_option("partial-loops")),
69+
debug_level(options.get_option("debug-level")),
6770
outer_symbol_table(outer_symbol_table),
6871
ns(outer_symbol_table),
6972
target(_target),
@@ -201,8 +204,6 @@ class goto_symext
201204
const get_goto_functiont &,
202205
statet &);
203206

204-
const optionst &options;
205-
206207
const unsigned max_depth;
207208
const bool doing_path_exploration;
208209
const bool allow_pointer_unsoundness;
@@ -218,6 +219,10 @@ class goto_symext
218219
protected:
219220
const bool constant_propagation;
220221
const bool self_loops_to_assumptions;
222+
const bool simplify_opt;
223+
const bool unwinding_assertions;
224+
const bool partial_loops;
225+
const std::string debug_level;
221226

222227
/// The symbol table associated with the goto-program that we're
223228
/// executing. This symbol table will not additionally contain objects

src/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void goto_symext::symex_assign_symbol(
247247
ssa_lhs,
248248
ssa_rhs,
249249
ns,
250-
options.get_bool_option("simplify"),
250+
simplify_opt,
251251
constant_propagation,
252252
allow_pointer_unsoundness);
253253

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ void goto_symext::symex_trace(
458458
{
459459
PRECONDITION(code.arguments().size() >= 2);
460460

461-
int debug_thresh=unsafe_string2int(options.get_option("debug-level"));
461+
int debug_thresh = unsafe_string2int(debug_level);
462462

463463
mp_integer debug_lvl;
464464
optionalt<mp_integer> maybe_debug =

src/goto-symex/symex_dereference.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ void goto_symext::dereference_rec(
281281
value_set_dereferencet dereference(
282282
ns,
283283
state.symbol_table,
284-
options,
285284
symex_dereference_state,
286285
language_mode,
287286
expr_is_not_null);

src/goto-symex/symex_function_call.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,13 @@ void goto_symext::symex_function_call_code(
236236
// see if it's too much
237237
if(stop_recursing)
238238
{
239-
if(options.get_bool_option("partial-loops"))
239+
if(partial_loops)
240240
{
241241
// it's ok, ignore
242242
}
243243
else
244244
{
245-
if(options.get_bool_option("unwinding-assertions"))
245+
if(unwinding_assertions)
246246
vcc(false_exprt(), "recursion unwinding assertion", state);
247247

248248
// add to state guard to prevent further assignments

src/goto-symex/symex_goto.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,6 @@ void goto_symext::loop_bound_exceeded(
515515
else
516516
negated_cond=not_exprt(guard);
517517

518-
bool unwinding_assertions=
519-
options.get_bool_option("unwinding-assertions");
520-
521-
bool partial_loops=
522-
options.get_bool_option("partial-loops");
523-
524518
if(!partial_loops)
525519
{
526520
if(unwinding_assertions)

src/pointer-analysis/goto_program_dereference.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ class goto_program_dereferencet:protected dereference_callbackt
3030
const namespacet &_ns,
3131
symbol_tablet &_new_symbol_table,
3232
const optionst &_options,
33-
value_setst &_value_sets):
34-
options(_options),
35-
ns(_ns),
36-
value_sets(_value_sets),
37-
dereference(_ns, _new_symbol_table, _options, *this, ID_nil, false)
38-
{
39-
}
33+
value_setst &_value_sets)
34+
: options(_options),
35+
ns(_ns),
36+
value_sets(_value_sets),
37+
dereference(_ns, _new_symbol_table, *this, ID_nil, false)
38+
{
39+
}
4040

4141
void dereference_program(
4242
goto_programt &goto_program,

src/pointer-analysis/value_set_dereference.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class value_set_dereferencet
3232
/*! \brief Constructor
3333
* \param _ns Namespace
3434
* \param _new_symbol_table A symbol_table to store new symbols in
35-
* \param _options Options, in particular whether pointer checks are
36-
to be performed
3735
* \param _dereference_callback Callback object for error reporting
3836
* \param _language_mode Mode for any new symbols created to represent
3937
a dereference failure
@@ -43,13 +41,11 @@ class value_set_dereferencet
4341
value_set_dereferencet(
4442
const namespacet &_ns,
4543
symbol_tablet &_new_symbol_table,
46-
const optionst &_options,
4744
dereference_callbackt &_dereference_callback,
4845
const irep_idt _language_mode,
4946
bool _exclude_null_derefs):
5047
ns(_ns),
5148
new_symbol_table(_new_symbol_table),
52-
options(_options),
5349
dereference_callback(_dereference_callback),
5450
language_mode(_language_mode),
5551
exclude_null_derefs(_exclude_null_derefs)
@@ -83,7 +79,6 @@ class value_set_dereferencet
8379
private:
8480
const namespacet &ns;
8581
symbol_tablet &new_symbol_table;
86-
const optionst &options;
8782
dereference_callbackt &dereference_callback;
8883
/// language_mode: ID_java, ID_C or another language identifier
8984
/// if we know the source language in use, irep_idt() otherwise.

0 commit comments

Comments
 (0)