Skip to content

Commit 9ed2ead

Browse files
Define function for array_pointer_association
This allows the constraint generator to do a pass on equations without adding axioms but just adding the assaciation between pointer and arrays.
1 parent 985b7cd commit 9ed2ead

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/solvers/refinement/string_constraint_generator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ class string_constraint_generatort final
136136

137137
array_poolt array_pool;
138138

139+
/// Associate array to pointer, and array to length
140+
/// \return an expression if the given function application is one of
141+
/// associate pointer and associate length
142+
optionalt<exprt>
143+
make_array_pointer_association(const function_application_exprt &expr);
144+
139145
// Type used by primitives to signal errors
140146
const signedbv_typet get_return_code_type()
141147
{

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,17 @@ static irep_idt get_function_name(const function_application_exprt &expr)
432432
: to_symbol_expr(name).get_identifier();
433433
}
434434

435+
optionalt<exprt> string_constraint_generatort::make_array_pointer_association(
436+
const function_application_exprt &expr)
437+
{
438+
const irep_idt &id = get_function_name(expr);
439+
if(id == ID_cprover_associate_array_to_pointer_func)
440+
return associate_array_to_pointer(expr);
441+
else if(id == ID_cprover_associate_length_to_array_func)
442+
return associate_length_to_array(expr);
443+
return {};
444+
}
445+
435446
/// strings contained in this call are converted to objects of type
436447
/// `string_exprt`, through adding axioms. Axioms are then added to enforce that
437448
/// the result corresponds to the function application.

0 commit comments

Comments
 (0)