@@ -124,7 +124,7 @@ void ci_lazy_methods_neededt::initialize_instantiated_classes_from_pointer(
124124 // explore again even if we've seen this classid before in the array case.
125125 if (add_needed_class (param_classid) || is_java_array_tag (param_classid))
126126 {
127- gather_field_types (pointer_type. base_type () , ns);
127+ gather_field_types (class_type , ns);
128128 }
129129
130130 if (is_java_generic_type (pointer_type))
@@ -145,33 +145,30 @@ void ci_lazy_methods_neededt::initialize_instantiated_classes_from_pointer(
145145// / \param class_type: root of class tree to search
146146// / \param ns: global namespaces.
147147void ci_lazy_methods_neededt::gather_field_types (
148- const typet &class_type,
148+ const struct_tag_typet &class_type,
149149 const namespacet &ns)
150150{
151- const auto &underlying_type = to_struct_type (ns.follow (class_type));
151+ const auto &underlying_type = ns.follow_tag (class_type);
152+
152153 if (is_java_array_tag (underlying_type.get_tag ()))
153154 {
154- // If class_type is not a symbol this may be a reference array,
155- // but we can't tell what type.
156- if (class_type.id () == ID_struct_tag)
155+ const typet &element_type = java_array_element_type (class_type);
156+ if (
157+ element_type.id () == ID_pointer &&
158+ to_pointer_type (element_type).base_type ().id () != ID_empty)
157159 {
158- const typet &element_type =
159- java_array_element_type (to_struct_tag_type (class_type));
160- if (
161- element_type.id () == ID_pointer &&
162- to_pointer_type (element_type).base_type ().id () != ID_empty)
163- {
164- // This is a reference array -- mark its element type available.
165- add_all_needed_classes (to_pointer_type (element_type));
166- }
160+ // This is a reference array -- mark its element type available.
161+ add_all_needed_classes (to_pointer_type (element_type));
167162 }
168163 }
169164 else
170165 {
171166 for (const auto &field : underlying_type.components ())
172167 {
173- if (field.type ().id () == ID_struct || field.type ().id () == ID_struct_tag)
174- gather_field_types (field.type (), ns);
168+ if (field.type ().id () == ID_struct_tag)
169+ gather_field_types (to_struct_tag_type (field.type ()), ns);
170+ else if (field.type ().id () == ID_struct)
171+ UNREACHABLE;
175172 else if (field.type ().id () == ID_pointer)
176173 {
177174 if (to_pointer_type (field.type ()).base_type ().id () == ID_struct_tag)
0 commit comments