@@ -124,7 +124,7 @@ void ci_lazy_methods_neededt::initialize_instantiated_classes_from_pointer(
124
124
// explore again even if we've seen this classid before in the array case.
125
125
if (add_needed_class (param_classid) || is_java_array_tag (param_classid))
126
126
{
127
- gather_field_types (pointer_type. base_type () , ns);
127
+ gather_field_types (class_type , ns);
128
128
}
129
129
130
130
if (is_java_generic_type (pointer_type))
@@ -145,33 +145,30 @@ void ci_lazy_methods_neededt::initialize_instantiated_classes_from_pointer(
145
145
// / \param class_type: root of class tree to search
146
146
// / \param ns: global namespaces.
147
147
void ci_lazy_methods_neededt::gather_field_types (
148
- const typet &class_type,
148
+ const struct_tag_typet &class_type,
149
149
const namespacet &ns)
150
150
{
151
- const auto &underlying_type = to_struct_type (ns.follow (class_type));
151
+ const auto &underlying_type = ns.follow_tag (class_type);
152
+
152
153
if (is_java_array_tag (underlying_type.get_tag ()))
153
154
{
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)
157
159
{
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));
167
162
}
168
163
}
169
164
else
170
165
{
171
166
for (const auto &field : underlying_type.components ())
172
167
{
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;
175
172
else if (field.type ().id () == ID_pointer)
176
173
{
177
174
if (to_pointer_type (field.type ()).base_type ().id () == ID_struct_tag)
0 commit comments