Skip to content

Commit e8105bd

Browse files
author
Daniel Kroening
authored
Merge pull request #1833 from diffblue/symex_class_cleanup
Symex class cleanup
2 parents 9620802 + 9ba7fe2 commit e8105bd

File tree

6 files changed

+113
-134
lines changed

6 files changed

+113
-134
lines changed

src/goto-symex/auto_objects.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void goto_symext::initialize_auto_object(
7676
address_of_expr);
7777

7878
code_assignt assignment(expr, rhs);
79-
symex_assign_rec(state, assignment);
79+
symex_assign(state, assignment);
8080
}
8181
}
8282
}

src/goto-symex/goto_symex.h

+100-109
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class goto_symext
8484
/// footprint, so if keeping the state around is not necessary,
8585
/// clients should instead call goto_symext::symex_from_entry_point_of().
8686
virtual void symex_with_state(
87-
statet &state,
88-
const goto_functionst &goto_functions,
89-
const goto_programt &goto_program);
87+
statet &,
88+
const goto_functionst &,
89+
const goto_programt &);
9090

9191
/// Symexes from the first instruction and the given state, terminating as
9292
/// soon as the last instruction is reached. This is useful to explicitly
@@ -97,8 +97,8 @@ class goto_symext
9797
/// \param first Entry point in form of a first instruction.
9898
/// \param limit Final instruction, which itself will not be symexed.
9999
virtual void symex_instruction_range(
100-
statet &state,
101-
const goto_functionst &goto_functions,
100+
statet &,
101+
const goto_functionst &,
102102
goto_programt::const_targett first,
103103
goto_programt::const_targett limit);
104104

@@ -111,8 +111,8 @@ class goto_symext
111111
/// \param limit final instruction, which itself will not
112112
/// be symexed.
113113
void initialize_entry_point(
114-
statet &state,
115-
const goto_functionst &goto_functions,
114+
statet &,
115+
const goto_functionst &,
116116
goto_programt::const_targett pc,
117117
goto_programt::const_targett limit);
118118

@@ -121,16 +121,16 @@ class goto_symext
121121
/// \param state Current GOTO symex step.
122122
/// \param goto_functions GOTO model to symex.
123123
void symex_threaded_step(
124-
statet &state, const goto_functionst &goto_functions);
124+
statet &, const goto_functionst &);
125125

126126
/** execute just one step */
127127
virtual void symex_step(
128-
const goto_functionst &goto_functions,
129-
statet &state);
128+
const goto_functionst &,
129+
statet &);
130130

131131
public:
132132
// these bypass the target maps
133-
virtual void symex_step_goto(statet &state, bool taken);
133+
virtual void symex_step_goto(statet &, bool taken);
134134

135135
// statistics
136136
unsigned total_vccs, remaining_vccs;
@@ -160,37 +160,33 @@ class goto_symext
160160
// b) remove pointer dereferencing
161161
// c) rewrite array_equal expression into equality
162162
void clean_expr(
163-
exprt &expr, statet &state, bool write);
164-
165-
void replace_array_equal(exprt &expr);
166-
void trigger_auto_object(const exprt &expr, statet &state);
167-
void initialize_auto_object(const exprt &expr, statet &state);
168-
void process_array_expr(exprt &expr);
169-
void process_array_expr_rec(exprt &expr, const typet &type) const;
170-
exprt make_auto_object(const typet &type);
171-
172-
virtual void dereference(
173-
exprt &expr,
174-
statet &state,
175-
const bool write);
163+
exprt &, statet &, bool write);
164+
165+
void replace_array_equal(exprt &);
166+
void trigger_auto_object(const exprt &, statet &);
167+
void initialize_auto_object(const exprt &, statet &);
168+
void process_array_expr(exprt &);
169+
void process_array_expr_rec(exprt &, const typet &) const;
170+
exprt make_auto_object(const typet &);
171+
virtual void dereference(exprt &, statet &, const bool write);
176172

177173
void dereference_rec(
178-
exprt &expr,
179-
statet &state,
180-
guardt &guard,
174+
exprt &,
175+
statet &,
176+
guardt &,
181177
const bool write);
182178

183179
void dereference_rec_address_of(
184-
exprt &expr,
185-
statet &state,
186-
guardt &guard);
180+
exprt &,
181+
statet &,
182+
guardt &);
187183

188184
static bool is_index_member_symbol_if(const exprt &expr);
189185

190186
exprt address_arithmetic(
191-
const exprt &expr,
192-
statet &state,
193-
guardt &guard,
187+
const exprt &,
188+
statet &,
189+
guardt &,
194190
bool keep_array);
195191

196192
// guards
@@ -199,83 +195,81 @@ class goto_symext
199195

200196
// symex
201197
virtual void symex_transition(
202-
statet &state,
198+
statet &,
203199
goto_programt::const_targett to,
204200
bool is_backwards_goto=false);
201+
205202
virtual void symex_transition(statet &state)
206203
{
207204
goto_programt::const_targett next=state.source.pc;
208205
++next;
209206
symex_transition(state, next);
210207
}
211208

212-
virtual void symex_goto(statet &state);
213-
virtual void symex_start_thread(statet &state);
214-
virtual void symex_atomic_begin(statet &state);
215-
virtual void symex_atomic_end(statet &state);
216-
virtual void symex_decl(statet &state);
217-
virtual void symex_decl(statet &state, const symbol_exprt &expr);
218-
virtual void symex_dead(statet &state);
219-
220-
virtual void symex_other(
221-
const goto_functionst &goto_functions,
222-
statet &state);
209+
virtual void symex_goto(statet &);
210+
virtual void symex_start_thread(statet &);
211+
virtual void symex_atomic_begin(statet &);
212+
virtual void symex_atomic_end(statet &);
213+
virtual void symex_decl(statet &);
214+
virtual void symex_decl(statet &, const symbol_exprt &expr);
215+
virtual void symex_dead(statet &);
216+
virtual void symex_other(const goto_functionst &, statet &);
223217

224218
virtual void vcc(
225-
const exprt &expr,
219+
const exprt &,
226220
const std::string &msg,
227-
statet &state);
221+
statet &);
228222

229-
virtual void symex_assume(statet &state, const exprt &cond);
223+
virtual void symex_assume(statet &, const exprt &cond);
230224

231225
// gotos
232-
void merge_gotos(statet &state);
226+
void merge_gotos(statet &);
233227

234228
virtual void merge_goto(
235229
const statet::goto_statet &goto_state,
236-
statet &state);
230+
statet &);
237231

238232
void merge_value_sets(
239233
const statet::goto_statet &goto_state,
240234
statet &dest);
241235

242236
void phi_function(
243237
const statet::goto_statet &goto_state,
244-
statet &state);
238+
statet &);
245239

246240
// determine whether to unwind a loop -- true indicates abort,
247241
// with false we continue.
248242
virtual bool get_unwind(
249243
const symex_targett::sourcet &source,
250244
unsigned unwind);
251245

252-
virtual void loop_bound_exceeded(statet &state, const exprt &guard);
246+
virtual void loop_bound_exceeded(statet &, const exprt &guard);
253247

254248
// function calls
255249

256-
void pop_frame(statet &state);
257-
void return_assignment(statet &state);
250+
void pop_frame(statet &);
251+
void return_assignment(statet &);
258252

259253
virtual void no_body(const irep_idt &identifier)
260254
{
261255
}
262256

263257
virtual void symex_function_call(
264-
const goto_functionst &goto_functions,
265-
statet &state,
266-
const code_function_callt &call);
258+
const goto_functionst &,
259+
statet &,
260+
const code_function_callt &);
267261

268-
virtual void symex_end_of_function(statet &state);
262+
virtual void symex_end_of_function(statet &);
269263

270264
virtual void symex_function_call_symbol(
271-
const goto_functionst &goto_functions,
272-
statet &state,
273-
const code_function_callt &call);
265+
const goto_functionst &,
266+
statet &,
267+
const code_function_callt &);
274268

275269
virtual void symex_function_call_code(
276-
const goto_functionst &goto_functions,
277-
statet &state,
278-
const code_function_callt &call);
270+
const goto_functionst &,
271+
statet &,
272+
const code_function_callt &);
279273

280274
virtual bool get_unwind_recursion(
281275
const irep_idt &identifier,
@@ -284,107 +278,104 @@ class goto_symext
284278

285279
void parameter_assignments(
286280
const irep_idt function_identifier,
287-
const goto_functionst::goto_functiont &goto_function,
288-
statet &state,
281+
const goto_functionst::goto_functiont &,
282+
statet &,
289283
const exprt::operandst &arguments);
290284

291285
void locality(
292286
const irep_idt function_identifier,
293-
statet &state,
294-
const goto_functionst::goto_functiont &goto_function);
287+
statet &,
288+
const goto_functionst::goto_functiont &);
295289

296290
void add_end_of_function(
297291
exprt &code,
298292
const irep_idt &identifier);
299293

300294
// exceptions
295+
void symex_throw(statet &);
296+
void symex_catch(statet &);
301297

302-
void symex_throw(statet &state);
303-
void symex_catch(statet &state);
304-
305-
virtual void do_simplify(exprt &expr);
298+
virtual void do_simplify(exprt &);
306299

307-
// virtual void symex_block(statet &state, const codet &code);
308-
void symex_assign_rec(statet &state, const code_assignt &code);
309-
virtual void symex_assign(statet &state, const code_assignt &code);
300+
void symex_assign(statet &, const code_assignt &);
310301

311302
// havocs the given object
312303
void havoc_rec(statet &, const guardt &, const exprt &);
313304

314305
typedef symex_targett::assignment_typet assignment_typet;
315306

316307
void symex_assign_rec(
317-
statet &state,
308+
statet &,
318309
const exprt &lhs,
319310
const exprt &full_lhs,
320311
const exprt &rhs,
321-
guardt &guard,
322-
assignment_typet assignment_type);
312+
guardt &,
313+
assignment_typet);
323314
void symex_assign_symbol(
324-
statet &state,
315+
statet &,
325316
const ssa_exprt &lhs,
326317
const exprt &full_lhs,
327318
const exprt &rhs,
328-
guardt &guard,
329-
assignment_typet assignment_type);
319+
guardt &,
320+
assignment_typet);
330321
void symex_assign_typecast(
331-
statet &state,
322+
statet &,
332323
const typecast_exprt &lhs,
333324
const exprt &full_lhs,
334325
const exprt &rhs,
335-
guardt &guard,
336-
assignment_typet assignment_type);
326+
guardt &,
327+
assignment_typet);
337328
void symex_assign_array(
338-
statet &state,
329+
statet &,
339330
const index_exprt &lhs,
340331
const exprt &full_lhs,
341332
const exprt &rhs,
342-
guardt &guard,
343-
assignment_typet assignment_type);
333+
guardt &,
334+
assignment_typet);
344335
void symex_assign_struct_member(
345-
statet &state,
336+
statet &,
346337
const member_exprt &lhs,
347338
const exprt &full_lhs,
348339
const exprt &rhs,
349-
guardt &guard,
350-
assignment_typet assignment_type);
340+
guardt &,
341+
assignment_typet);
351342
void symex_assign_if(
352-
statet &state,
343+
statet &,
353344
const if_exprt &lhs,
354345
const exprt &full_lhs,
355346
const exprt &rhs,
356-
guardt &guard,
357-
assignment_typet assignment_type);
347+
guardt &,
348+
assignment_typet);
358349
void symex_assign_byte_extract(
359-
statet &state,
350+
statet &,
360351
const byte_extract_exprt &lhs,
361352
const exprt &full_lhs,
362353
const exprt &rhs,
363-
guardt &guard,
364-
assignment_typet assignment_type);
354+
guardt &,
355+
assignment_typet);
365356

366357
static exprt add_to_lhs(const exprt &lhs, const exprt &what);
367358

368359
virtual void symex_gcc_builtin_va_arg_next(
369-
statet &state, const exprt &lhs, const side_effect_exprt &code);
360+
statet &, const exprt &lhs, const side_effect_exprt &);
370361
virtual void symex_allocate(
371-
statet &state, const exprt &lhs, const side_effect_exprt &code);
372-
virtual void symex_cpp_delete(statet &state, const codet &code);
362+
statet &, const exprt &lhs, const side_effect_exprt &);
363+
virtual void symex_cpp_delete(statet &, const codet &);
373364
virtual void symex_cpp_new(
374-
statet &state, const exprt &lhs, const side_effect_exprt &code);
375-
virtual void symex_fkt(statet &state, const code_function_callt &code);
376-
virtual void symex_macro(statet &state, const code_function_callt &code);
377-
virtual void symex_trace(statet &state, const code_function_callt &code);
378-
virtual void symex_printf(statet &state, const exprt &lhs, const exprt &rhs);
379-
virtual void symex_input(statet &state, const codet &code);
380-
virtual void symex_output(statet &state, const codet &code);
365+
statet &, const exprt &lhs, const side_effect_exprt &);
366+
virtual void symex_fkt(statet &, const code_function_callt &);
367+
virtual void symex_macro(statet &, const code_function_callt &);
368+
virtual void symex_trace(statet &, const code_function_callt &);
369+
virtual void symex_printf(statet &, const exprt &lhs, const exprt &rhs);
370+
virtual void symex_input(statet &, const codet &);
371+
virtual void symex_output(statet &, const codet &);
381372

382373
static unsigned nondet_count;
383374
static unsigned dynamic_counter;
384375

385-
void read(exprt &expr);
386-
void replace_nondet(exprt &expr);
387-
void rewrite_quantifiers(exprt &expr, statet &state);
376+
void read(exprt &);
377+
void replace_nondet(exprt &);
378+
void rewrite_quantifiers(exprt &, statet &);
388379
};
389380

390381
#endif // CPROVER_GOTO_SYMEX_GOTO_SYMEX_H

0 commit comments

Comments
 (0)