@@ -301,20 +301,22 @@ void string_refinementt::set_to(const exprt &expr, bool value)
301
301
}
302
302
303
303
// / Add association for each char pointer in the equation
304
+ // / \param symbol_solver: a union_find_replacet object to keep track of
305
+ // / char pointer equations
304
306
// / \param equations: vector of equations
305
307
// / \param ns: namespace
306
308
// / \param stream: output stream
307
309
// / \return union_find_replacet where char pointer that have been set equal
308
310
// / by an equation are associated to the same element
309
- static union_find_replacet generate_symbol_resolution_from_equations (
311
+ static void add_equations_for_symbol_resolution (
312
+ union_find_replacet &symbol_solver,
310
313
const std::vector<equal_exprt> &equations,
311
314
const namespacet &ns,
312
315
messaget::mstreamt &stream)
313
316
{
314
317
const auto eom = messaget::eom;
315
318
const std::string log_message =
316
319
" WARNING string_refinement.cpp generate_symbol_resolution_from_equations:" ;
317
- union_find_replacet solver;
318
320
for (const equal_exprt &eq : equations)
319
321
{
320
322
const exprt &lhs = eq.lhs ();
@@ -335,7 +337,7 @@ static union_find_replacet generate_symbol_resolution_from_equations(
335
337
336
338
if (is_char_pointer_type (rhs.type ()))
337
339
{
338
- solver .make_union (lhs, rhs);
340
+ symbol_solver .make_union (lhs, rhs);
339
341
}
340
342
else if (rhs.id () == ID_function_application)
341
343
{
@@ -355,7 +357,7 @@ static union_find_replacet generate_symbol_resolution_from_equations(
355
357
const member_exprt lhs_data (lhs, comp.get_name (), comp.type ());
356
358
const exprt rhs_data = simplify_expr (
357
359
member_exprt (rhs, comp.get_name (), comp.type ()), ns);
358
- solver .make_union (lhs_data, rhs_data);
360
+ symbol_solver .make_union (lhs_data, rhs_data);
359
361
}
360
362
}
361
363
}
@@ -366,7 +368,6 @@ static union_find_replacet generate_symbol_resolution_from_equations(
366
368
}
367
369
}
368
370
}
369
- return solver;
370
371
}
371
372
372
373
// / This is meant to be used on the lhs of an equation with string subtype.
@@ -613,9 +614,9 @@ decision_proceduret::resultt string_refinementt::dec_solve()
613
614
#endif
614
615
615
616
debug () << " dec_solve: Build symbol solver from equations" << eom;
616
- // This is used by get, that's why we use a class member here
617
- symbol_resolve =
618
- generate_symbol_resolution_from_equations ( equations, ns, debug ());
617
+ // symbol_resolve is used by get and is kept between calls to dec_solve,
618
+ // that's why we use a class member here
619
+ add_equations_for_symbol_resolution (symbol_resolve, equations, ns, debug ());
619
620
#ifdef DEBUG
620
621
debug () << " symbol resolve:" << eom;
621
622
for (const auto &pair : symbol_resolve.to_vector ())
0 commit comments