Skip to content

Commit c71effb

Browse files
committed
WIP: cleanup language_mode
1 parent 81f175e commit c71effb

14 files changed

+18
-38
lines changed

src/goto-checker/symex_bmc.cpp

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

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

19-
#include <linking/static_lifetime_init.h>
20-
2119
#include <limits>
2220

2321
symex_bmct::symex_bmct(
@@ -40,10 +38,6 @@ symex_bmct::symex_bmct(
4038
unwindset(unwindset),
4139
symex_coverage(ns)
4240
{
43-
const symbolt *init_symbol = outer_symbol_table.lookup(INITIALIZE_FUNCTION);
44-
if(init_symbol)
45-
language_mode = init_symbol->mode;
46-
4741
messaget msg{mh};
4842
msg.status() << "Starting Bounded Model Checking" << messaget::eom;
4943
}

src/goto-symex/goto_symex.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void goto_symext::do_simplify(exprt &expr, const statet &state)
3636
{
3737
if(state.threads.size() == 1)
3838
{
39-
simplify_expr_with_value_sett{state.value_set, language_mode, ns}
39+
simplify_expr_with_value_sett{state.value_set, state.language_mode, ns}
4040
.simplify(expr);
4141
}
4242
else
@@ -118,7 +118,6 @@ void goto_symext::symex_assign(
118118
assignment_type,
119119
ns,
120120
symex_config,
121-
language_mode,
122121
target};
123122

124123
// Try to constant propagate potential side effects of the assignment, when
@@ -154,7 +153,6 @@ void goto_symext::symex_assign(
154153
assignment_type,
155154
ns,
156155
symex_config,
157-
language_mode,
158156
target}
159157
.assign_rec(lhs, expr_skeletont{}, rhs, lhs_if_then_else_conditions);
160158

src/goto-symex/goto_symex.h

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

238-
/// language_mode: ID_java, ID_C or another language identifier
239-
/// if we know the source language in use, irep_idt() otherwise.
240-
irep_idt language_mode;
241-
242238
/// The symbol table associated with the goto-program being executed.
243239
/// This symbol table will not have objects that are dynamically created as
244240
/// part of symbolic execution added to it; those object are stored in the

src/goto-symex/goto_symex_state.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,11 @@ class goto_symex_statet final : public goto_statet
258258
lvalue.id() == ID_array;
259259
}
260260

261-
private:
261+
/// language_mode: ID_java, ID_C or another language identifier
262+
/// if we know the source language in use, irep_idt() otherwise.
262263
const irep_idt &language_mode;
264+
265+
private:
263266
std::function<std::size_t(const irep_idt &)> fresh_l2_name_provider;
264267

265268
/// \brief Dangerous, do not use

src/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void symex_assignt::assign_non_struct_symbol(
207207

208208
if(symex_config.simplify_opt)
209209
{
210-
simplify_expr_with_value_sett{state.value_set, language_mode, ns}.simplify(
210+
simplify_expr_with_value_sett{state.value_set, state.language_mode, ns}.simplify(
211211
assignment.rhs);
212212
}
213213

src/goto-symex/symex_assign.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ class symex_assignt
3333
symex_targett::assignment_typet assignment_type,
3434
const namespacet &ns,
3535
const symex_configt &symex_config,
36-
const irep_idt &language_mode,
3736
symex_targett &target)
3837
: shadow_memory(shadow_memory),
3938
state(state),
4039
assignment_type(assignment_type),
4140
ns(ns),
4241
symex_config(symex_config),
43-
language_mode(language_mode),
4442
target(target)
4543
{
4644
}
@@ -67,7 +65,6 @@ class symex_assignt
6765
symex_targett::assignment_typet assignment_type;
6866
const namespacet &ns;
6967
const symex_configt &symex_config;
70-
const irep_idt &language_mode;
7168
symex_targett &target;
7269

7370
void assign_from_struct(

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void goto_symext::symex_allocate(
7272
{
7373
// to allow constant propagation
7474
exprt tmp_size = state.rename(size, ns).get();
75-
simplify_expr_with_value_sett{state.value_set, language_mode, ns}.simplify(
75+
simplify_expr_with_value_sett{state.value_set, state.language_mode, ns}.simplify(
7676
tmp_size);
7777

7878
// special treatment for sizeof(T)*x
@@ -167,7 +167,7 @@ void goto_symext::symex_allocate(
167167

168168
// to allow constant propagation
169169
exprt zero_init = state.rename(to_binary_expr(code).op1(), ns).get();
170-
simplify_expr_with_value_sett{state.value_set, language_mode, ns}.simplify(
170+
simplify_expr_with_value_sett{state.value_set, state.language_mode, ns}.simplify(
171171
zero_init);
172172

173173
INVARIANT(
@@ -433,7 +433,7 @@ void goto_symext::symex_printf(
433433
}
434434

435435
const irep_idt format_string =
436-
get_string_argument(operands[0], state.value_set, language_mode, ns);
436+
get_string_argument(operands[0], state.value_set, state.language_mode, ns);
437437

438438
if(!format_string.empty())
439439
target.output_fmt(
@@ -459,7 +459,7 @@ void goto_symext::symex_input(
459459
}
460460

461461
const irep_idt input_id =
462-
get_string_argument(id_arg, state.value_set, language_mode, ns);
462+
get_string_argument(id_arg, state.value_set, state.language_mode, ns);
463463

464464
target.input(state.guard.as_expr(), state.source, input_id, args);
465465
}
@@ -478,14 +478,14 @@ void goto_symext::symex_output(
478478
renamedt<exprt, L2> l2_arg = state.rename(code.operands()[i], ns);
479479
if(symex_config.simplify_opt)
480480
{
481-
simplify_expr_with_value_sett simp{state.value_set, language_mode, ns};
481+
simplify_expr_with_value_sett simp{state.value_set, state.language_mode, ns};
482482
l2_arg.simplify(simp);
483483
}
484484
args.emplace_back(l2_arg);
485485
}
486486

487487
const irep_idt output_id =
488-
get_string_argument(id_arg, state.value_set, language_mode, ns);
488+
get_string_argument(id_arg, state.value_set, state.language_mode, ns);
489489

490490
target.output(state.guard.as_expr(), state.source, output_id, args);
491491
}

src/goto-symex/symex_clean_expr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void goto_symext::process_array_expr(statet &state, exprt &expr)
127127
ns,
128128
state.symbol_table,
129129
symex_dereference_state,
130-
language_mode,
130+
state.language_mode,
131131
false,
132132
log.get_message_handler());
133133

@@ -187,7 +187,6 @@ void goto_symext::lift_let(statet &state, const let_exprt &let_expr)
187187
symex_targett::assignment_typet::HIDDEN,
188188
ns,
189189
symex_config,
190-
language_mode,
191190
target}
192191
.assign_symbol(
193192
to_ssa_expr(state.rename<L1>(let_expr.symbol(), ns).get()),

src/goto-symex/symex_dereference.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ goto_symext::cache_dereference(exprt &dereference_result, statet &state)
220220
"symex",
221221
"dereference_cache",
222222
dereference_result.source_location(),
223-
language_mode,
223+
state.language_mode,
224224
ns,
225225
state.symbol_table)
226226
.symbol_expr();
@@ -236,7 +236,6 @@ goto_symext::cache_dereference(exprt &dereference_result, statet &state)
236236
symex_targett::assignment_typet::STATE,
237237
ns,
238238
symex_config,
239-
language_mode,
240239
target};
241240

242241
assign.assign_symbol(
@@ -328,7 +327,7 @@ void goto_symext::dereference_rec(
328327
ns,
329328
state.symbol_table,
330329
symex_dereference_state,
331-
language_mode,
330+
state.language_mode,
332331
expr_is_not_null,
333332
log.get_message_handler());
334333

src/goto-symex/symex_function_call.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ void goto_symext::parameter_assignments(
136136
assignment_type,
137137
ns,
138138
symex_config,
139-
language_mode,
140139
target}
141140
.assign_rec(lhs, expr_skeletont{}, rhs, lhs_conditions);
142141
}

0 commit comments

Comments
 (0)