Skip to content

Commit 58d6122

Browse files
Make replace_nondet a non-member function
This makes the information flow more obvious.
1 parent c6d3055 commit 58d6122

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/goto-symex/goto_symex.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ void goto_symext::do_simplify(exprt &expr)
2222
simplify(expr, ns);
2323
}
2424

25-
nondet_symbol_exprt goto_symext::build_symex_nondet(typet &type)
25+
nondet_symbol_exprt build_symex_nondet(typet &type, unsigned &nondet_count)
2626
{
2727
irep_idt identifier = "symex::nondet" + std::to_string(nondet_count++);
2828
nondet_symbol_exprt new_expr(identifier, type);
2929
return new_expr;
3030
}
3131

32-
void goto_symext::replace_nondet(exprt &expr)
32+
void replace_nondet(exprt &expr, unsigned &nondet_count)
3333
{
3434
if(expr.id()==ID_side_effect &&
3535
expr.get(ID_statement)==ID_nondet)
3636
{
37-
nondet_symbol_exprt new_expr = build_symex_nondet(expr.type());
37+
nondet_symbol_exprt new_expr =
38+
build_symex_nondet(expr.type(), nondet_count);
3839
new_expr.add_source_location()=expr.source_location();
3940
expr.swap(new_expr);
4041
}
4142
else
4243
Forall_operands(it, expr)
43-
replace_nondet(*it);
44+
replace_nondet(*it, nondet_count);
4445
}

src/goto-symex/goto_symex.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@ class goto_symext
320320
statet &,
321321
const goto_functionst::goto_functiont &);
322322

323-
nondet_symbol_exprt build_symex_nondet(typet &type);
324-
325323
// exceptions
326324
void symex_throw(statet &);
327325
void symex_catch(statet &);
@@ -404,7 +402,6 @@ class goto_symext
404402
static unsigned nondet_count;
405403
static unsigned dynamic_counter;
406404

407-
void replace_nondet(exprt &);
408405
void rewrite_quantifiers(exprt &, statet &);
409406

410407
path_storaget &path_storage;
@@ -452,6 +449,10 @@ class goto_symext
452449
}
453450
};
454451

452+
nondet_symbol_exprt build_symex_nondet(typet &type, unsigned &nondet_count);
453+
454+
void replace_nondet(exprt &, unsigned &);
455+
455456
void symex_transition(goto_symext::statet &state);
456457

457458
void symex_transition(

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void goto_symext::symex_allocate(
177177
}
178178
else
179179
{
180-
const exprt nondet = build_symex_nondet(object_type);
180+
const exprt nondet = build_symex_nondet(object_type, nondet_count);
181181
const code_assignt assignment(value_symbol.symbol_expr(), nondet);
182182
symex_assign(state, assignment);
183183
}

src/goto-symex/symex_clean_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void goto_symext::clean_expr(
140140
statet &state,
141141
const bool write)
142142
{
143-
replace_nondet(expr);
143+
replace_nondet(expr, nondet_count);
144144
dereference(expr, state, write);
145145

146146
// make sure all remaining byte extract operations use the root

0 commit comments

Comments
 (0)