@@ -196,6 +196,8 @@ gen_clinit_eqexpr(const exprt &expr, const clinit_statest state)
196
196
// / \param class_name: name of the class to generate clinit wrapper calls for
197
197
// / \param [out] init_body: appended with calls to clinit wrapper
198
198
// / \param nondet_static: true if nondet-static option was given
199
+ // / \param replace_clinit: true iff calls to clinit are replaced with calls to
200
+ // / user_specified_clinit.
199
201
// / \param object_factory_parameters: object factory parameters used to populate
200
202
// / nondet-initialized globals and objects reachable from them (only needed
201
203
// / if nondet-static is true)
@@ -207,6 +209,7 @@ static void clinit_wrapper_do_recursive_calls(
207
209
const irep_idt &class_name,
208
210
code_blockt &init_body,
209
211
const bool nondet_static,
212
+ const bool replace_clinit,
210
213
const java_object_factory_parameterst &object_factory_parameters,
211
214
const select_pointer_typet &pointer_type_selector,
212
215
message_handlert &message_handler)
@@ -220,8 +223,10 @@ static void clinit_wrapper_do_recursive_calls(
220
223
init_body.add (code_function_callt{base_init_func->symbol_expr ()});
221
224
}
222
225
223
- const irep_idt &real_clinit_name = clinit_function_name (class_name);
224
- if (const auto clinit_func = symbol_table.lookup (real_clinit_name))
226
+ const irep_idt &clinit_name = replace_clinit
227
+ ? user_specified_clinit_name (class_name)
228
+ : clinit_function_name (class_name);
229
+ if (const auto clinit_func = symbol_table.lookup (clinit_name))
225
230
init_body.add (code_function_callt{clinit_func->symbol_expr ()});
226
231
227
232
// If nondet-static option is given, add a standard nondet initialization for
@@ -482,6 +487,8 @@ static void create_clinit_wrapper_symbols(
482
487
// / name created by `create_clinit_wrapper_symbols`)
483
488
// / \param symbol_table: global symbol table
484
489
// / \param nondet_static: true if nondet-static option was given
490
+ // / \param replace_clinit: true iff calls to clinit are replaced with calls to
491
+ // / user_specified_clinit.
485
492
// / \param object_factory_parameters: object factory parameters used to populate
486
493
// / nondet-initialized globals and objects reachable from them (only needed
487
494
// / if nondet-static is true)
@@ -493,6 +500,7 @@ code_blockt get_thread_safe_clinit_wrapper_body(
493
500
const irep_idt &function_id,
494
501
symbol_table_baset &symbol_table,
495
502
const bool nondet_static,
503
+ const bool replace_clinit,
496
504
const java_object_factory_parameterst &object_factory_parameters,
497
505
const select_pointer_typet &pointer_type_selector,
498
506
message_handlert &message_handler)
@@ -645,6 +653,7 @@ code_blockt get_thread_safe_clinit_wrapper_body(
645
653
*class_name,
646
654
init_body,
647
655
nondet_static,
656
+ replace_clinit,
648
657
object_factory_parameters,
649
658
pointer_type_selector,
650
659
message_handler);
@@ -674,6 +683,8 @@ code_blockt get_thread_safe_clinit_wrapper_body(
674
683
// / name created by `create_clinit_wrapper_symbols`)
675
684
// / \param symbol_table: global symbol table
676
685
// / \param nondet_static: true if nondet-static option was given
686
+ // / \param replace_clinit: true iff calls to clinit are replaced with calls to
687
+ // / user_specified_clinit.
677
688
// / \param object_factory_parameters: object factory parameters used to populate
678
689
// / nondet-initialized globals and objects reachable from them (only needed
679
690
// / if nondet-static is true)
@@ -685,6 +696,7 @@ code_ifthenelset get_clinit_wrapper_body(
685
696
const irep_idt &function_id,
686
697
symbol_table_baset &symbol_table,
687
698
const bool nondet_static,
699
+ const bool replace_clinit,
688
700
const java_object_factory_parameterst &object_factory_parameters,
689
701
const select_pointer_typet &pointer_type_selector,
690
702
message_handlert &message_handler)
@@ -729,6 +741,7 @@ code_ifthenelset get_clinit_wrapper_body(
729
741
*class_name,
730
742
init_body,
731
743
nondet_static,
744
+ replace_clinit,
732
745
object_factory_parameters,
733
746
pointer_type_selector,
734
747
message_handler);
0 commit comments