@@ -8,16 +8,6 @@ Author: Diffblue Ltd.
8
8
9
9
#include " assignments_from_json.h"
10
10
11
- #include " ci_lazy_methods_needed.h"
12
- #include " code_with_references.h"
13
- #include " java_static_initializers.h"
14
- #include " java_string_literals.h"
15
- #include " java_types.h"
16
- #include " java_utils.h"
17
-
18
- #include < goto-programs/allocate_objects.h>
19
- #include < goto-programs/class_identifier.h>
20
-
21
11
#include < util/arith_tools.h>
22
12
#include < util/array_element_from_pointer.h>
23
13
#include < util/expr_initializer.h>
@@ -26,6 +16,17 @@ Author: Diffblue Ltd.
26
16
#include < util/symbol_table_base.h>
27
17
#include < util/unicode.h>
28
18
19
+ #include < goto-programs/allocate_objects.h>
20
+ #include < goto-programs/class_identifier.h>
21
+ #include < goto-programs/goto_instruction_code.h>
22
+
23
+ #include " ci_lazy_methods_needed.h"
24
+ #include " code_with_references.h"
25
+ #include " java_static_initializers.h"
26
+ #include " java_string_literals.h"
27
+ #include " java_types.h"
28
+ #include " java_utils.h"
29
+
29
30
// / Values passed around between most functions of the recursive deterministic
30
31
// / assignment algorithm entered from \ref assign_from_json.
31
32
// / The values in a given `object_creation_infot` are never reassigned, but the
@@ -345,43 +346,44 @@ assign_primitive_from_json(const exprt &expr, const jsont &json)
345
346
return result;
346
347
if (expr.type () == java_boolean_type ())
347
348
{
348
- result.add (code_assignt {
349
+ result.add (code_frontend_assignt {
349
350
expr, json.is_true () ? (exprt)true_exprt{} : (exprt)false_exprt{}});
350
351
}
351
352
else if (
352
353
expr.type () == java_int_type () || expr.type () == java_byte_type () ||
353
354
expr.type () == java_short_type () || expr.type () == java_long_type ())
354
355
{
355
- result.add (
356
- code_assignt{ expr, from_integer (std::stoll (json.value ), expr.type ())});
356
+ result.add (code_frontend_assignt{
357
+ expr, from_integer (std::stoll (json.value ), expr.type ())});
357
358
}
358
359
else if (expr.type () == java_double_type ())
359
360
{
360
361
ieee_floatt ieee_float (to_floatbv_type (expr.type ()));
361
362
ieee_float.from_double (std::stod (json.value ));
362
- result.add (code_assignt {expr, ieee_float.to_expr ()});
363
+ result.add (code_frontend_assignt {expr, ieee_float.to_expr ()});
363
364
}
364
365
else if (expr.type () == java_float_type ())
365
366
{
366
367
ieee_floatt ieee_float (to_floatbv_type (expr.type ()));
367
368
ieee_float.from_float (std::stof (json.value ));
368
- result.add (code_assignt {expr, ieee_float.to_expr ()});
369
+ result.add (code_frontend_assignt {expr, ieee_float.to_expr ()});
369
370
}
370
371
else if (expr.type () == java_char_type ())
371
372
{
372
373
const std::wstring wide_value = utf8_to_utf16_native_endian (json.value );
373
374
PRECONDITION (wide_value.length () == 1 );
374
- result.add (
375
- code_assignt{ expr, from_integer (wide_value.front (), expr.type ())});
375
+ result.add (code_frontend_assignt{
376
+ expr, from_integer (wide_value.front (), expr.type ())});
376
377
}
377
378
return result;
378
379
}
379
380
380
381
// / One of the base cases of the recursive algorithm. See
381
382
// / \ref assign_from_json_rec.
382
- static code_assignt assign_null (const exprt &expr)
383
+ static code_frontend_assignt assign_null (const exprt &expr)
383
384
{
384
- return code_assignt{expr, null_pointer_exprt{to_pointer_type (expr.type ())}};
385
+ return code_frontend_assignt{
386
+ expr, null_pointer_exprt{to_pointer_type (expr.type ())}};
385
387
}
386
388
387
389
// / In the case of an assignment of an array given a JSON representation, this
@@ -405,7 +407,8 @@ static code_with_references_listt assign_array_data_component_from_json(
405
407
info.allocate_objects .allocate_automatic_local_object (
406
408
data_member_expr.type (), " user_specified_array_data_init" );
407
409
code_with_references_listt result;
408
- result.add (code_assignt{array_init_data, data_member_expr, info.loc });
410
+ result.add (
411
+ code_frontend_assignt{array_init_data, data_member_expr, info.loc });
409
412
410
413
size_t index = 0 ;
411
414
const optionalt<std::string> inferred_element_type =
@@ -432,8 +435,8 @@ nondet_length(allocate_objectst &allocate, source_locationt loc)
432
435
symbol_exprt length_expr = allocate.allocate_automatic_local_object (
433
436
java_int_type (), " user_specified_array_length" );
434
437
code_with_references_listt code;
435
- code.add (
436
- code_assignt{ length_expr, side_effect_expr_nondett{java_int_type (), loc}});
438
+ code.add (code_frontend_assignt{
439
+ length_expr, side_effect_expr_nondett{java_int_type (), loc}});
437
440
code.add (code_assumet{binary_predicate_exprt{
438
441
length_expr, ID_ge, from_integer (0 , java_int_type ())}});
439
442
return std::make_pair (length_expr, std::move (code));
@@ -506,16 +509,17 @@ static code_with_references_listt assign_nondet_length_array_from_json(
506
509
// / One of the cases in the recursive algorithm: the case where \p expr
507
510
// / represents a string.
508
511
// / See \ref assign_from_json_rec.
509
- static code_assignt assign_string_from_json (
512
+ static code_frontend_assignt assign_string_from_json (
510
513
const jsont &json,
511
514
const exprt &expr,
512
515
object_creation_infot &info)
513
516
{
514
517
const auto json_string = get_untyped_string (json);
515
518
PRECONDITION (json_string.is_string ());
516
- return code_assignt{expr,
517
- get_or_create_string_literal_symbol (
518
- json_string.value , info.symbol_table , true )};
519
+ return code_frontend_assignt{
520
+ expr,
521
+ get_or_create_string_literal_symbol (
522
+ json_string.value , info.symbol_table , true )};
519
523
}
520
524
521
525
// / Helper function for \ref assign_struct_from_json which recursively assigns
@@ -586,7 +590,7 @@ static code_with_references_listt assign_struct_from_json(
586
590
to_struct_expr (*initial_object),
587
591
ns,
588
592
struct_tag_typet (" java::" + id2string (java_class_type.get_tag ())));
589
- result.add (code_assignt {expr, *initial_object});
593
+ result.add (code_frontend_assignt {expr, *initial_object});
590
594
result.append (assign_struct_components_from_json (expr, json, info));
591
595
}
592
596
return result;
@@ -646,7 +650,7 @@ static code_with_references_listt assign_enum_from_json(
646
650
const exprt ordinal_expr =
647
651
from_integer (std::stoi (json[" ordinal" ].value ), java_int_type ());
648
652
649
- result.add (code_assignt {
653
+ result.add (code_frontend_assignt {
650
654
expr,
651
655
typecast_exprt::conditional_cast (
652
656
array_element_from_pointer (values_data, ordinal_expr), expr.type ())});
@@ -696,7 +700,8 @@ static code_with_references_listt assign_pointer_with_given_type_from_json(
696
700
}
697
701
698
702
auto result = assign_pointer_from_json (new_symbol, json, info);
699
- result.add (code_assignt{expr, typecast_exprt{new_symbol, pointer_type}});
703
+ result.add (
704
+ code_frontend_assignt{expr, typecast_exprt{new_symbol, pointer_type}});
700
705
return result;
701
706
}
702
707
else
@@ -828,7 +833,7 @@ static code_with_references_listt assign_reference_from_json(
828
833
assign_struct_from_json (dereference_exprt (reference.expr ), json, info));
829
834
}
830
835
}
831
- result.add (code_assignt {
836
+ result.add (code_frontend_assignt {
832
837
expr, typecast_exprt::conditional_cast (reference.expr , expr.type ())});
833
838
return result;
834
839
}
0 commit comments