Skip to content

Commit da7b234

Browse files
Make replace_nondet a non-member function
This makes the information flow more obvious.
1 parent 0d8beda commit da7b234

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/goto-symex/goto_symex.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ 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 = build_symex_nondet(expr.type(), nondet_count);
3838
new_expr.add_source_location()=expr.source_location();
3939
expr.swap(new_expr);
4040
}
4141
else
4242
Forall_operands(it, expr)
43-
replace_nondet(*it);
43+
replace_nondet(*it, nondet_count);
4444
}

src/goto-symex/goto_symex.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ class goto_symext
331331
statet &,
332332
const goto_functionst::goto_functiont &);
333333

334-
nondet_symbol_exprt build_symex_nondet(typet &type);
335-
336334
// exceptions
337335
void symex_throw(statet &);
338336
void symex_catch(statet &);
@@ -415,7 +413,6 @@ class goto_symext
415413
static unsigned nondet_count;
416414
static unsigned dynamic_counter;
417415

418-
void replace_nondet(exprt &);
419416
void rewrite_quantifiers(exprt &, statet &);
420417

421418
path_storaget &path_storage;
@@ -463,6 +460,10 @@ class goto_symext
463460
}
464461
};
465462

463+
nondet_symbol_exprt build_symex_nondet(typet &type, unsigned &nondet_count);
464+
465+
void replace_nondet(exprt &, unsigned &);
466+
466467
void symex_transition(goto_symext::statet &state);
467468

468469
void symex_transition(

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)