Skip to content

Commit 763f4da

Browse files
committed
Make goto_symext::language_mode protected
This should be set via constructors. Remove bmc_util/setup_symex as all work is done through constructors.
1 parent 501d788 commit 763f4da

9 files changed

+17
-37
lines changed

src/goto-checker/bmc_util.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Author: Daniel Kroening, Peter Schrammel
1111

1212
#include "bmc_util.h"
1313

14-
#include <iostream>
14+
#include <util/json_stream.h>
15+
#include <util/ui_message.h>
1516

1617
#include <goto-programs/graphml_witness.h>
1718
#include <goto-programs/json_goto_trace.h>
@@ -21,17 +22,13 @@ Author: Daniel Kroening, Peter Schrammel
2122
#include <goto-symex/memory_model_pso.h>
2223
#include <goto-symex/slice.h>
2324
#include <goto-symex/symex_target_equation.h>
24-
25-
#include <linking/static_lifetime_init.h>
26-
2725
#include <solvers/decision_procedure.h>
2826

29-
#include <util/json_stream.h>
30-
#include <util/ui_message.h>
31-
3227
#include "goto_symex_property_decider.h"
3328
#include "symex_bmc.h"
3429

30+
#include <iostream>
31+
3532
void message_building_error_trace(messaget &log)
3633
{
3734
log.status() << "Building error trace" << messaget::eom;
@@ -175,21 +172,6 @@ get_memory_model(const optionst &options, const namespacet &ns)
175172
}
176173
}
177174

178-
void setup_symex(
179-
symex_bmct &symex,
180-
const namespacet &ns,
181-
ui_message_handlert &ui_message_handler)
182-
{
183-
messaget msg(ui_message_handler);
184-
const symbolt *init_symbol;
185-
if(!ns.lookup(INITIALIZE_FUNCTION, init_symbol))
186-
symex.language_mode = init_symbol->mode;
187-
188-
msg.status() << "Starting Bounded Model Checking" << messaget::eom;
189-
190-
symex.last_source_location.make_nil();
191-
}
192-
193175
void slice(
194176
symex_bmct &symex,
195177
symex_target_equationt &symex_target_equation,

src/goto-checker/bmc_util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ void output_graphml(
6969
std::unique_ptr<memory_model_baset>
7070
get_memory_model(const optionst &options, const namespacet &);
7171

72-
void setup_symex(symex_bmct &, const namespacet &, ui_message_handlert &);
73-
7472
void slice(
7573
symex_bmct &,
7674
symex_target_equationt &symex_target_equation,

src/goto-checker/multi_path_symex_only_checker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ multi_path_symex_only_checkert::multi_path_symex_only_checkert(
3939
unwindset.parse_unwind(options.get_option("unwind"));
4040
unwindset.parse_unwindset(
4141
options.get_list_option("unwindset"), goto_model, ui_message_handler);
42-
setup_symex(symex, ns, ui_message_handler);
4342
}
4443

4544
incremental_goto_checkert::resultt multi_path_symex_only_checkert::

src/goto-checker/single_loop_incremental_symex_checker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ single_loop_incremental_symex_checkert::single_loop_incremental_symex_checkert(
4242
unwindset.parse_unwind(options.get_option("unwind"));
4343
unwindset.parse_unwindset(
4444
options.get_list_option("unwindset"), goto_model, ui_message_handler);
45-
setup_symex(symex, ns, ui_message_handler);
4645

4746
// Freeze all symbols if we are using a prop_conv_solvert
4847
prop_conv_solvert *prop_conv_solver = dynamic_cast<prop_conv_solvert *>(

src/goto-checker/single_path_symex_only_checker.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ void single_path_symex_only_checkert::equation_output(
152152
}
153153
}
154154

155-
void single_path_symex_only_checkert::setup_symex(symex_bmct &symex)
156-
{
157-
::setup_symex(symex, ns, ui_message_handler);
158-
}
159-
160155
void single_path_symex_only_checkert::update_properties(
161156
propertiest &properties,
162157
std::unordered_set<irep_idt> &updated_properties,

src/goto-checker/single_path_symex_only_checker.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ class single_path_symex_only_checkert : public incremental_goto_checkert
4848
const symex_bmct &symex,
4949
const symex_target_equationt &equation);
5050

51-
virtual void setup_symex(symex_bmct &symex);
51+
virtual void setup_symex(symex_bmct &symex)
52+
{
53+
// deriving classes may do extra work here
54+
}
5255

5356
/// Adds the initial goto-symex state as a path to the worklist
5457
virtual void initialize_worklist();

src/goto-checker/symex_bmc.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Author: Daniel Kroening, [email protected]
1616

1717
#include <goto-programs/unwindset.h>
1818

19+
#include <linking/static_lifetime_init.h>
20+
1921
#include <limits>
2022

2123
symex_bmct::symex_bmct(
@@ -33,10 +35,17 @@ symex_bmct::symex_bmct(
3335
options,
3436
path_storage,
3537
guard_manager),
38+
last_source_location(source_locationt::nil()),
3639
record_coverage(!options.get_option("symex-coverage-report").empty()),
3740
unwindset(unwindset),
3841
symex_coverage(ns)
3942
{
43+
const symbolt *init_symbol = outer_symbol_table.lookup(INITIALIZE_FUNCTION);
44+
if(init_symbol)
45+
language_mode = init_symbol->mode;
46+
47+
messaget msg{mh};
48+
msg.status() << "Starting Bounded Model Checking" << messaget::eom;
4049
}
4150

4251
/// show progress

src/goto-symex/goto_symex.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,10 @@ class goto_symext
235235
messaget::mstreamt &
236236
print_callstack_entry(const symex_targett::sourcet &target);
237237

238-
public:
239-
240238
/// language_mode: ID_java, ID_C or another language identifier
241239
/// if we know the source language in use, irep_idt() otherwise.
242240
irep_idt language_mode;
243241

244-
protected:
245242
/// The symbol table associated with the goto-program being executed.
246243
/// This symbol table will not have objects that are dynamically created as
247244
/// part of symbolic execution added to it; those object are stored in the

unit/path_strategies.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ void _check_with_strategy(
425425
*worklist,
426426
guard_manager,
427427
unwindset);
428-
setup_symex(symex, ns, ui_message_handler);
429428

430429
symex.initialize_path_storage_from_entry_point_of(
431430
goto_symext::get_goto_function(goto_model),
@@ -448,7 +447,6 @@ void _check_with_strategy(
448447
*worklist,
449448
guard_manager,
450449
unwindset);
451-
setup_symex(symex, ns, ui_message_handler);
452450

453451
symex_symbol_table = symex.resume_symex_from_saved_state(
454452
goto_symext::get_goto_function(goto_model),

0 commit comments

Comments
 (0)