@@ -184,7 +184,7 @@ gen_clinit_eqexpr(const exprt &expr, const clinit_statest state)
184
184
// / \param class_name: name of the class to generate clinit wrapper calls for
185
185
// / \param [out] init_body: appended with calls to clinit wrapper
186
186
static void clinit_wrapper_do_recursive_calls (
187
- const symbol_tablet &symbol_table,
187
+ symbol_table_baset &symbol_table,
188
188
const irep_idt &class_name,
189
189
code_blockt &init_body,
190
190
const bool nondet_static,
@@ -208,9 +208,43 @@ static void clinit_wrapper_do_recursive_calls(
208
208
auto find_sym_it = symbol_table.symbols .find (real_clinit_name);
209
209
if (find_sym_it != symbol_table.symbols .end ())
210
210
{
211
- code_function_callt call_real_init;
212
- call_real_init.function () = find_sym_it->second .symbol_expr ();
213
- init_body.move_to_operands (call_real_init);
211
+ if (!nondet_static)
212
+ {
213
+ code_function_callt call_real_init;
214
+ call_real_init.function () = find_sym_it->second .symbol_expr ();
215
+ init_body.move_to_operands (call_real_init);
216
+ }
217
+ else
218
+ {
219
+ object_factory_parameterst parameters = object_factory_parameters;
220
+ parameters.function_id = real_clinit_name;
221
+
222
+ for (const auto &symbol : symbol_table.symbols )
223
+ {
224
+ if (
225
+ symbol.second .is_static_lifetime &&
226
+ symbol.second .type .get (ID_C_class) == class_name)
227
+ {
228
+ const symbol_exprt new_global_symbol = symbol.second .symbol_expr ();
229
+
230
+ parameters.max_nonnull_tree_depth =
231
+ is_non_null_library_global (symbol.first )
232
+ ? object_factory_parameters.max_nonnull_tree_depth + 1
233
+ : object_factory_parameters.max_nonnull_tree_depth ;
234
+
235
+ gen_nondet_init (
236
+ new_global_symbol,
237
+ init_body,
238
+ symbol_table,
239
+ source_locationt (),
240
+ false ,
241
+ allocation_typet::DYNAMIC,
242
+ parameters,
243
+ pointer_type_selector,
244
+ update_in_placet::NO_UPDATE_IN_PLACE);
245
+ }
246
+ }
247
+ }
214
248
}
215
249
}
216
250
0 commit comments