Skip to content

Commit 1a669a0

Browse files
Declaring concretize_arrays_in_expression in header file
This allows in particular to unit test it Also update its documentation Also renamed from concretize_array_expression: this reflects more precisely what this function is doing.
1 parent df36583 commit 1a669a0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/solvers/refinement/string_refinement.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,14 +1098,14 @@ static exprt negation_of_constraint(const string_constraintt &axiom)
10981098

10991099
/// Result of the solver `supert` should not be interpreted literally for char
11001100
/// arrays as not all indices are present in the index set.
1101-
/// We populate the values for which the solver has no constraint by padding
1102-
/// the array to the left.
1101+
/// In the given expression, we populate arrays at the indices for which the
1102+
/// solver has no constraint by copying values to the left.
11031103
/// For example an expression `ARRAY_OF(0) WITH [1:=2] WITH [4:=3]` would
11041104
/// be interpreted as `{ 2, 2, 3, 3, 3}`.
11051105
/// \param expr: expression to interpret
1106-
/// \param string_max_length: maximum size of arrays to concider
1106+
/// \param string_max_length: maximum size of arrays to consider
11071107
/// \return the interpreted expression
1108-
static exprt concretize_array_expression(
1108+
exprt concretize_arrays_in_expression(
11091109
const exprt &expr, std::size_t string_max_length)
11101110
{
11111111
if(expr.id()==ID_index)
@@ -1122,7 +1122,7 @@ static exprt concretize_array_expression(
11221122
{
11231123
exprt copy=expr;
11241124
for(exprt &op : copy.operands())
1125-
op=concretize_array_expression(op, string_max_length);
1125+
op=concretize_arrays_in_expression(op, string_max_length);
11261126
return copy;
11271127
}
11281128
}
@@ -1160,7 +1160,7 @@ bool string_refinementt::check_axioms()
11601160
debug() << " - negated_axiom:\n"
11611161
<< " " << from_expr(ns, "", negaxiom) << eom;
11621162

1163-
exprt with_concretized_arrays=concretize_array_expression(
1163+
exprt with_concretized_arrays=concretize_arrays_in_expression(
11641164
negaxiom, generator.max_string_length);
11651165
debug() << " - negated_axiom_with_concretized_array_access:\n"
11661166
<< " " << from_expr(ns, "", with_concretized_arrays) << eom;

src/solvers/refinement/string_refinement.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ class string_refinementt: public bv_refinementt
160160

161161
exprt substitute_array_lists(exprt expr, size_t string_max_length);
162162

163+
exprt concretize_arrays_in_expression(
164+
const exprt &expr, std::size_t string_max_length);
165+
163166
/// Utility function for concretization of strings. Copies concretized values to
164167
/// the left to initialize the unconcretized indices of concrete_array.
165168
/// \param concrete_array: the vector to populate

0 commit comments

Comments
 (0)