@@ -257,18 +257,23 @@ static std::vector<exprt> generate_instantiations(
257
257
// / \param expr: an expression possibly containing function applications
258
258
// / \param generator: generator for the string constraints
259
259
// / \return an expression containing no function application
260
- static exprt substitute_function_applications (
261
- exprt expr,
260
+ static void substitute_function_applications (
261
+ exprt & expr,
262
262
string_constraint_generatort &generator)
263
263
{
264
- for (auto &operand : expr.operands ())
265
- operand = substitute_function_applications (operand, generator);
266
-
267
- if (expr.id () == ID_function_application)
268
- return generator.add_axioms_for_function_application (
269
- to_function_application_expr (expr));
270
-
271
- return expr;
264
+ for (auto it = expr.depth_begin (), itend = expr.depth_end ();
265
+ it != itend;) // No ++it
266
+ {
267
+ if (it->id () == ID_function_application)
268
+ {
269
+ it.mutate () =
270
+ generator.add_axioms_for_function_application (
271
+ to_function_application_expr (expr));
272
+ it.next_sibling_or_parent ();
273
+ }
274
+ else
275
+ ++it;
276
+ }
272
277
}
273
278
274
279
// / Remove functions applications and create the necessary axioms.
@@ -280,7 +285,7 @@ static void substitute_function_applications_in_equations(
280
285
string_constraint_generatort &generator)
281
286
{
282
287
for (auto &eq : equations)
283
- eq. rhs () = substitute_function_applications (eq.rhs (), generator);
288
+ substitute_function_applications (eq.rhs (), generator);
284
289
}
285
290
286
291
// / For now, any unsigned bitvector type of width smaller or equal to 16 is
0 commit comments