@@ -336,22 +336,24 @@ void add_symbol_to_symbol_map(
336
336
337
337
// / add axioms if the rhs is a character array
338
338
// / \par parameters: the rhs and lhs of an equality over character arrays
339
- void string_refinementt::set_char_array_equality (
340
- const exprt &lhs, const exprt &rhs)
339
+ std::vector<exprt> set_char_array_equality (const exprt &lhs, const exprt &rhs)
341
340
{
342
341
PRECONDITION (lhs.id ()==ID_symbol);
343
342
344
343
if (rhs.id ()==ID_array && rhs.type ().id ()==ID_array)
345
344
{
345
+ std::vector<exprt> lemmas;
346
346
const typet &index_type=to_array_type (rhs.type ()).size ().type ();
347
347
for (size_t i=0 , ilim=rhs.operands ().size (); i!=ilim; ++i)
348
348
{
349
349
// Introduce axioms to map symbolic rhs to its char array.
350
350
index_exprt arraycell (rhs, from_integer (i, index_type));
351
351
equal_exprt arrayeq (arraycell, rhs.operands ()[i]);
352
- add_lemma (arrayeq, false );
352
+ lemmas. push_back (arrayeq);
353
353
}
354
+ return lemmas;
354
355
}
356
+ return { };
355
357
// At least for Java (as it is currently pre-processed), we need not consider
356
358
// other cases, because all character arrays find themselves on the rhs of an
357
359
// equality. Note that this might not be the case for other languages.
@@ -402,7 +404,9 @@ bool string_refinementt::add_axioms_for_string_assigns(
402
404
{
403
405
if (is_char_array (ns, rhs.type ()))
404
406
{
405
- set_char_array_equality (lhs, rhs);
407
+ for (const auto & lemma : set_char_array_equality (lhs, rhs))
408
+ add_lemma (lemma, false );
409
+
406
410
if (rhs.id () == ID_symbol || rhs.id () == ID_array)
407
411
{
408
412
add_symbol_to_symbol_map (
0 commit comments