@@ -2228,13 +2228,9 @@ exprt substitute_array_lists(exprt expr, size_t string_max_length)
2228
2228
// / \return evaluated expression
2229
2229
exprt string_refinementt::get (const exprt &expr) const
2230
2230
{
2231
- // clang-format off
2232
- const auto super_get = [this ](const exprt &expr)
2233
- {
2231
+ const auto super_get = [this ](const exprt &expr) {
2234
2232
return supert::get (expr);
2235
2233
};
2236
- // clang-format on
2237
-
2238
2234
exprt ecopy (expr);
2239
2235
(void )symbol_resolve.replace_expr (ecopy);
2240
2236
@@ -2248,35 +2244,25 @@ exprt string_refinementt::get(const exprt &expr) const
2248
2244
dependencies.eval (arr, [&](const exprt &expr) { return get (expr); }))
2249
2245
return *from_dependencies;
2250
2246
2251
- const auto arr_model_opt =
2252
- get_array (super_get, ns, generator.max_string_length , debug (), arr);
2253
- // \todo Refactor with get array in model
2254
- if (arr_model_opt)
2247
+ if (
2248
+ const auto arr_model_opt =
2249
+ get_array (super_get, ns, generator.max_string_length , debug (), arr))
2255
2250
{
2256
- const exprt arr_model = simplify_expr (*arr_model_opt, ns);
2257
- const exprt concretized_array = concretize_arrays_in_expression (
2258
- arr_model, generator.max_string_length , ns);
2259
- return concretized_array;
2251
+ // \todo get_array should take care of the concretization
2252
+ return concretize_arrays_in_expression (
2253
+ *arr_model_opt, generator.max_string_length , ns);
2260
2254
}
2261
- else
2255
+
2256
+ if (generator.get_created_strings ().count (arr))
2262
2257
{
2263
- auto set = generator. get_created_strings ( );
2264
- if (set. find (arr) != set. end ( ))
2258
+ const exprt length = super_get (arr. length () );
2259
+ if (const auto n = numeric_cast<std:: size_t >(length ))
2265
2260
{
2266
- exprt length = super_get (arr.length ());
2267
- if (const auto n = numeric_cast<std::size_t >(length))
2268
- {
2269
- exprt arr_model =
2270
- array_exprt (array_typet (arr.type ().subtype (), length));
2271
- for (size_t i = 0 ; i < *n; i++)
2272
- arr_model.copy_to_operands (exprt (ID_unknown, arr.type ().subtype ()));
2273
- const exprt concretized_array = concretize_arrays_in_expression (
2274
- arr_model, generator.max_string_length , ns);
2275
- return concretized_array;
2276
- }
2261
+ const array_exprt arr_model (array_typet (arr.type ().subtype (), length));
2262
+ return fill_in_array_expr (arr_model, generator.max_string_length );
2277
2263
}
2278
- return arr;
2279
2264
}
2265
+ return arr;
2280
2266
}
2281
2267
return supert::get (ecopy);
2282
2268
}
0 commit comments