@@ -417,7 +417,7 @@ void initialize_nondet_string_fields(
417
417
namespacet ns (symbol_table);
418
418
419
419
const struct_typet &struct_type =
420
- to_struct_type ( ns.follow (struct_expr.type ()));
420
+ ns.follow_tag ( to_struct_tag_type (struct_expr.type ()));
421
421
422
422
// In case the type for String was not added to the symbol table,
423
423
// (typically when string refinement is not activated), `struct_type`
@@ -538,7 +538,8 @@ void java_object_factoryt::gen_nondet_pointer_init(
538
538
generic_parameter_specialization_map_keys (
539
539
generic_parameter_specialization_map);
540
540
generic_parameter_specialization_map_keys.insert_pairs_for_pointer (
541
- replacement_pointer_type, ns.follow (replacement_pointer_type.subtype ()));
541
+ replacement_pointer_type,
542
+ ns.follow (to_struct_tag_type (replacement_pointer_type.subtype ())));
542
543
543
544
const symbol_exprt real_pointer_symbol = gen_nondet_subtype_pointer_init (
544
545
assignments, lifetime, replacement_pointer_type, depth, location);
@@ -568,24 +569,21 @@ void java_object_factoryt::gen_nondet_pointer_init(
568
569
// the pointer to NULL instead of recursively initializing the struct to which
569
570
// it points.
570
571
const typet &subtype = pointer_type.subtype ();
571
- const typet &followed_subtype = ns.follow (subtype);
572
- if (followed_subtype.id () == ID_struct)
573
- {
574
- const struct_typet &struct_type = to_struct_type (followed_subtype);
575
- const irep_idt &struct_tag=struct_type.get_tag ();
572
+ const struct_typet &struct_type = ns.follow_tag (to_struct_tag_type (subtype));
573
+ const irep_idt &struct_tag = struct_type.get_tag ();
576
574
577
- // If this is a recursive type of some kind AND the depth is exceeded, set
578
- // the pointer to null.
579
- if (!recursion_set_entry.insert_entry (struct_tag) &&
580
- depth>=object_factory_parameters.max_nondet_tree_depth )
575
+ // If this is a recursive type of some kind AND the depth is exceeded, set
576
+ // the pointer to null.
577
+ if (
578
+ !recursion_set_entry.insert_entry (struct_tag) &&
579
+ depth >= object_factory_parameters.max_nondet_tree_depth )
580
+ {
581
+ if (update_in_place == update_in_placet::NO_UPDATE_IN_PLACE)
581
582
{
582
- if (update_in_place==update_in_placet::NO_UPDATE_IN_PLACE)
583
- {
584
- assignments.add (get_null_assignment (expr, pointer_type));
585
- }
586
- // Otherwise leave it as it is.
587
- return ;
583
+ assignments.add (get_null_assignment (expr, pointer_type));
588
584
}
585
+ // Otherwise leave it as it is.
586
+ return ;
589
587
}
590
588
591
589
// If this is a void* we *must* initialise with null:
@@ -609,7 +607,7 @@ void java_object_factoryt::gen_nondet_pointer_init(
609
607
// ci_lazy_methodst::initialize_instantiated_classes.
610
608
if (
611
609
const auto class_type =
612
- type_try_dynamic_cast<java_class_typet>(followed_subtype ))
610
+ type_try_dynamic_cast<java_class_typet>(struct_type ))
613
611
{
614
612
if (class_type->get_base (" java::java.lang.Enum" ) && !must_be_null)
615
613
{
@@ -830,7 +828,7 @@ void java_object_factoryt::gen_nondet_struct_init(
830
828
const update_in_placet &update_in_place,
831
829
const source_locationt &location)
832
830
{
833
- PRECONDITION (ns. follow ( expr.type ()) .id ()==ID_struct );
831
+ PRECONDITION (expr.type ().id () == ID_struct_tag );
834
832
PRECONDITION (struct_type.id ()==ID_struct);
835
833
836
834
typedef struct_typet::componentst componentst;
@@ -1043,7 +1041,7 @@ void java_object_factoryt::gen_nondet_init(
1043
1041
generic_parameter_specialization_map_keys (
1044
1042
generic_parameter_specialization_map);
1045
1043
generic_parameter_specialization_map_keys.insert_pairs_for_pointer (
1046
- pointer_type, ns.follow ( pointer_type.subtype ()));
1044
+ pointer_type, ns.follow_tag ( to_struct_tag_type ( pointer_type.subtype () )));
1047
1045
1048
1046
gen_nondet_pointer_init (
1049
1047
assignments,
@@ -1056,21 +1054,19 @@ void java_object_factoryt::gen_nondet_init(
1056
1054
}
1057
1055
else if (followed_type.id () == ID_struct)
1058
1056
{
1059
- const struct_typet struct_type = to_struct_type (followed_type);
1057
+ const struct_typet & struct_type = to_struct_type (followed_type);
1060
1058
1061
1059
// If we are about to initialize a generic class (as a superclass object
1062
1060
// for a different object), add its concrete types to the map and delete
1063
1061
// them on leaving this function scope.
1064
1062
generic_parameter_specialization_map_keyst
1065
1063
generic_parameter_specialization_map_keys (
1066
1064
generic_parameter_specialization_map);
1065
+
1067
1066
if (is_sub)
1068
1067
{
1069
- const typet &symbol =
1070
- override_type.has_value () ? *override_type : expr.type ();
1071
- PRECONDITION (symbol.id () == ID_struct_tag);
1072
1068
generic_parameter_specialization_map_keys.insert_pairs_for_symbol (
1073
- to_struct_tag_type (symbol ), struct_type);
1069
+ to_struct_tag_type (type ), struct_type);
1074
1070
}
1075
1071
1076
1072
gen_nondet_struct_init (
@@ -1391,8 +1387,9 @@ void java_object_factoryt::gen_nondet_array_init(
1391
1387
PRECONDITION (expr.type ().subtype ().id () == ID_struct_tag);
1392
1388
PRECONDITION (update_in_place != update_in_placet::MAY_UPDATE_IN_PLACE);
1393
1389
1394
- const typet &type = ns.follow (expr.type ().subtype ());
1395
- const struct_typet &struct_type = to_struct_type (type);
1390
+ const struct_tag_typet &struct_tag_type =
1391
+ to_struct_tag_type (expr.type ().subtype ());
1392
+ const struct_typet &struct_type = ns.follow_tag (struct_tag_type);
1396
1393
const typet &element_type =
1397
1394
static_cast <const typet &>(expr.type ().subtype ().find (ID_element_type));
1398
1395
@@ -1475,7 +1472,8 @@ void java_object_factoryt::gen_nondet_enum_init(
1475
1472
1476
1473
// Access members (length and data) of $VALUES array
1477
1474
dereference_exprt deref_expr (values.symbol_expr ());
1478
- const auto &deref_struct_type = to_struct_type (ns.follow (deref_expr.type ()));
1475
+ const auto &deref_struct_type =
1476
+ ns.follow_tag (to_struct_tag_type (deref_expr.type ()));
1479
1477
PRECONDITION (is_valid_java_array (deref_struct_type));
1480
1478
const auto &comps = deref_struct_type.components ();
1481
1479
const member_exprt length_expr (deref_expr, " length" , comps[1 ].type ());
0 commit comments