@@ -422,19 +422,18 @@ static void assign_array_data_component_from_json(
422
422
423
423
// / Allocate a fresh array of length \p array_length_expr and assigns \p expr
424
424
// / to it.
425
- static void allocate_array (
425
+ static codet allocate_array (
426
426
const exprt &expr,
427
427
const exprt &array_length_expr,
428
- object_creation_infot &info )
428
+ const source_locationt &loc )
429
429
{
430
430
const pointer_typet &pointer_type = to_pointer_type (expr.type ());
431
431
const auto &element_type =
432
432
java_array_element_type (to_struct_tag_type (pointer_type.subtype ()));
433
433
side_effect_exprt java_new_array{ID_java_new_array, pointer_type};
434
434
java_new_array.copy_to_operands (array_length_expr);
435
435
java_new_array.type ().subtype ().set (ID_element_type, element_type);
436
- code_assignt assign{expr, java_new_array, info.loc };
437
- info.block .add (assign);
436
+ return code_assignt{expr, java_new_array, loc};
438
437
}
439
438
440
439
// / Declare a non-deterministic length expression
@@ -737,7 +736,8 @@ static std::pair<bool, object_creation_referencet> get_or_create_reference(
737
736
side_effect_expr_nondett{java_int_type ()}});
738
737
info.block .add (code_assumet{binary_predicate_exprt{
739
738
*reference.array_length , ID_ge, from_integer (0 , java_int_type ())}});
740
- allocate_array (reference.expr , *reference.array_length , info);
739
+ info.block .add (
740
+ allocate_array (reference.expr , *reference.array_length , info.loc ));
741
741
info.references .insert ({id, reference});
742
742
}
743
743
else
@@ -843,7 +843,7 @@ void assign_from_json_rec(
843
843
{
844
844
const exprt length =
845
845
nondet_length (info.allocate_objects , info.block , info.loc );
846
- allocate_array (expr, length, info);
846
+ info. block . add ( allocate_array (expr, length, info. loc ) );
847
847
assign_nondet_length_array_from_json (
848
848
expr, json, length, type_from_array, info);
849
849
}
@@ -853,7 +853,8 @@ void assign_from_json_rec(
853
853
const auto &element_type =
854
854
java_array_element_type (to_struct_tag_type (expr.type ().subtype ()));
855
855
const std::size_t length = get_untyped_array (json, element_type).size ();
856
- allocate_array (expr, from_integer (length, java_int_type ()), info);
856
+ info.block .add (allocate_array (
857
+ expr, from_integer (length, java_int_type ()), info.loc ));
857
858
assign_array_data_component_from_json (
858
859
expr, json, type_from_array, info);
859
860
}
0 commit comments