@@ -80,7 +80,7 @@ void symex_assignt::assign_rec(
80
80
assign_symbol (to_ssa_expr (lhs), full_lhs, rhs, guard);
81
81
}
82
82
else if (lhs.id () == ID_index)
83
- assign_array (to_index_expr (lhs), full_lhs, rhs, guard);
83
+ assign_array< use_update ()> (to_index_expr (lhs), full_lhs, rhs, guard);
84
84
else if (lhs.id ()==ID_member)
85
85
{
86
86
const typet &type = to_member_expr (lhs).struct_op ().type ();
@@ -464,6 +464,7 @@ void symex_assignt::assign_typecast(
464
464
assign_rec (lhs.op (), new_full_lhs, rhs_typecasted, guard);
465
465
}
466
466
467
+ template <bool use_update>
467
468
void symex_assignt::assign_array (
468
469
const index_exprt &lhs,
469
470
const exprt &full_lhs,
@@ -476,34 +477,26 @@ void symex_assignt::assign_array(
476
477
477
478
PRECONDITION (lhs_index_type.id () == ID_array);
478
479
479
- #ifdef USE_UPDATE
480
-
481
- // turn
482
- // a[i]=e
483
- // into
484
- // a'==UPDATE(a, [i], e)
485
-
486
- update_exprt new_rhs (lhs_index_type);
487
- new_rhs.old ()=lhs_array;
488
- new_rhs.designator ().push_back (index_designatort (lhs_index));
489
- new_rhs.new_value ()=rhs;
490
-
491
- exprt new_full_lhs=add_to_lhs (full_lhs, lhs);
492
-
493
- symex_assign_rec (
494
- state, lhs_array, new_full_lhs, new_rhs, guard, assignment_type);
495
-
496
- #else
497
- // turn
498
- // a[i]=e
499
- // into
500
- // a'==a WITH [i:=e]
501
-
502
- const with_exprt new_rhs{lhs_array, lhs_index, rhs};
503
- const exprt new_full_lhs = add_to_lhs (full_lhs, lhs);
504
-
505
- assign_rec (lhs_array, new_full_lhs, new_rhs, guard);
506
- #endif
480
+ if (use_update)
481
+ {
482
+ // turn
483
+ // a[i]=e
484
+ // into
485
+ // a'==UPDATE(a, [i], e)
486
+ const update_exprt new_rhs{lhs_array, index_designatort (lhs_index), rhs};
487
+ const exprt new_full_lhs = add_to_lhs (full_lhs, lhs);
488
+ assign_rec (lhs_array, new_full_lhs, new_rhs, guard);
489
+ }
490
+ else
491
+ {
492
+ // turn
493
+ // a[i]=e
494
+ // into
495
+ // a'==a WITH [i:=e]
496
+ const with_exprt new_rhs{lhs_array, lhs_index, rhs};
497
+ const exprt new_full_lhs = add_to_lhs (full_lhs, lhs);
498
+ assign_rec (lhs_array, new_full_lhs, new_rhs, guard);
499
+ }
507
500
}
508
501
509
502
void symex_assignt::assign_struct_member (
0 commit comments