Skip to content

Commit bbee9d1

Browse files
committed
Remove optionst member from goto_symext
goto_symext now has a const reference rather than owning a member. There is no need to copy an optionst by value from bmct.
1 parent 34a3d85 commit bbee9d1

File tree

6 files changed

+34
-15
lines changed

6 files changed

+34
-15
lines changed

src/cbmc/bmc.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ void bmct::get_memory_model()
305305
void bmct::setup()
306306
{
307307
get_memory_model();
308-
symex.options=options;
309308

310309
{
311310
const symbolt *init_symbol;
@@ -561,7 +560,7 @@ safety_checkert::resultt bmct::stop_on_fail(prop_convt &prop_conv)
561560
/// See class member `bmct::driver_callback_after_symex` for details.
562561
int bmct::do_language_agnostic_bmc(
563562
const path_strategy_choosert &path_strategy_chooser,
564-
const optionst &opts,
563+
optionst &opts,
565564
abstract_goto_modelt &model,
566565
const ui_message_handlert::uit &ui,
567566
messaget &message,

src/cbmc/bmc.h

+21-7
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class bmct:public safety_checkert
6464
/// `path_storage` and using it to construct a path_explorert
6565
/// object.
6666
bmct(
67-
const optionst &_options,
67+
optionst &_options,
6868
const symbol_tablet &outer_symbol_table,
6969
message_handlert &_message_handler,
7070
prop_convt &_prop_conv,
@@ -76,14 +76,21 @@ class bmct:public safety_checkert
7676
ns(outer_symbol_table, symex_symbol_table),
7777
equation(),
7878
path_storage(_path_storage),
79-
symex(_message_handler, outer_symbol_table, equation, path_storage),
79+
symex(
80+
_message_handler,
81+
outer_symbol_table,
82+
equation,
83+
options,
84+
path_storage),
8085
prop_conv(_prop_conv),
8186
ui(ui_message_handlert::uit::PLAIN),
8287
driver_callback_after_symex(callback_after_symex)
8388
{
8489
symex.constant_propagation=options.get_bool_option("propagation");
8590
symex.record_coverage=
8691
!options.get_option("symex-coverage-report").empty();
92+
options.set_option("simplify", true);
93+
options.set_option("assertions", true);
8794
}
8895

8996
virtual resultt run(const goto_functionst &goto_functions)
@@ -118,7 +125,7 @@ class bmct:public safety_checkert
118125

119126
static int do_language_agnostic_bmc(
120127
const path_strategy_choosert &path_strategy_chooser,
121-
const optionst &opts,
128+
optionst &opts,
122129
abstract_goto_modelt &goto_model,
123130
const ui_message_handlert::uit &ui,
124131
messaget &message,
@@ -135,7 +142,7 @@ class bmct:public safety_checkert
135142
/// symex_target_equationt. See the documentation for path_explorert for
136143
/// details.
137144
bmct(
138-
const optionst &_options,
145+
optionst &_options,
139146
const symbol_tablet &outer_symbol_table,
140147
message_handlert &_message_handler,
141148
prop_convt &_prop_conv,
@@ -148,21 +155,28 @@ class bmct:public safety_checkert
148155
ns(outer_symbol_table),
149156
equation(_equation),
150157
path_storage(_path_storage),
151-
symex(_message_handler, outer_symbol_table, equation, path_storage),
158+
symex(
159+
_message_handler,
160+
outer_symbol_table,
161+
equation,
162+
options,
163+
path_storage),
152164
prop_conv(_prop_conv),
153165
ui(ui_message_handlert::uit::PLAIN),
154166
driver_callback_after_symex(callback_after_symex)
155167
{
156168
symex.constant_propagation = options.get_bool_option("propagation");
157169
symex.record_coverage =
158170
!options.get_option("symex-coverage-report").empty();
171+
options.set_option("simplify", true);
172+
options.set_option("assertions", true);
159173
INVARIANT(
160174
options.get_bool_option("paths"),
161175
"Should only use saved equation & goto_state constructor "
162176
"when doing path exploration");
163177
}
164178

165-
const optionst &options;
179+
optionst &options;
166180
/// \brief symbol table for the goto-program that we will execute
167181
const symbol_tablet &outer_symbol_table;
168182
/// \brief symbol table generated during symbolic execution
@@ -252,7 +266,7 @@ class path_explorert : public bmct
252266
{
253267
public:
254268
path_explorert(
255-
const optionst &_options,
269+
optionst &_options,
256270
const symbol_tablet &outer_symbol_table,
257271
message_handlert &_message_handler,
258272
prop_convt &_prop_conv,

src/cbmc/symex_bmc.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ symex_bmct::symex_bmct(
2222
message_handlert &mh,
2323
const symbol_tablet &outer_symbol_table,
2424
symex_target_equationt &_target,
25+
const optionst &options,
2526
path_storaget &path_storage)
26-
: goto_symext(mh, outer_symbol_table, _target, path_storage),
27+
: goto_symext(mh, outer_symbol_table, _target, options, path_storage),
2728
record_coverage(false),
2829
symex_coverage(ns)
2930
{

src/cbmc/symex_bmc.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class symex_bmct: public goto_symext
2929
message_handlert &mh,
3030
const symbol_tablet &outer_symbol_table,
3131
symex_target_equationt &_target,
32+
const optionst &options,
3233
path_storaget &path_storage);
3334

3435
// To show progress

src/goto-instrument/accelerate/scratch_program.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ class scratch_programt:public goto_programt
4343
ns(symbol_table, symex_symbol_table),
4444
equation(),
4545
path_storage(),
46-
symex(mh, symbol_table, equation, path_storage),
46+
options(),
47+
symex(mh, symbol_table, equation, options, path_storage),
4748
satcheck(util_make_unique<satcheckt>()),
4849
satchecker(ns, *satcheck),
4950
z3(ns, "accelerate", "", "", smt2_dect::solvert::Z3),
5051
checker(&z3) // checker(&satchecker)
5152
{
53+
options.set_option("simplify", true);
54+
options.set_option("assertions", true);
5255
}
5356

5457
void append(goto_programt::instructionst &instructions);
@@ -80,6 +83,7 @@ class scratch_programt:public goto_programt
8083
namespacet ns;
8184
symex_target_equationt equation;
8285
path_fifot path_storage;
86+
optionst options;
8387
goto_symext symex;
8488

8589
std::unique_ptr<propt> satcheck;

src/goto-symex/goto_symex.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class goto_symext
5252
message_handlert &mh,
5353
const symbol_tablet &outer_symbol_table,
5454
symex_target_equationt &_target,
55+
const optionst &options,
5556
path_storaget &path_storage)
5657
: should_pause_symex(false),
58+
options(options),
5759
total_vccs(0),
5860
remaining_vccs(0),
5961
constant_propagation(true),
@@ -66,8 +68,6 @@ class goto_symext
6668
guard_identifier("goto_symex::\\guard"),
6769
path_storage(path_storage)
6870
{
69-
options.set_option("simplify", true);
70-
options.set_option("assertions", true);
7171
}
7272

7373
virtual ~goto_symext()
@@ -194,6 +194,8 @@ class goto_symext
194194
const get_goto_functiont &,
195195
statet &);
196196

197+
const optionst &options;
198+
197199
public:
198200
// these bypass the target maps
199201
virtual void symex_step_goto(statet &, bool taken);
@@ -203,8 +205,6 @@ class goto_symext
203205

204206
bool constant_propagation;
205207

206-
optionst options;
207-
208208
/// language_mode: ID_java, ID_C or another language identifier
209209
/// if we know the source language in use, irep_idt() otherwise.
210210
irep_idt language_mode;

0 commit comments

Comments
 (0)