@@ -792,6 +792,14 @@ code_blockt get_user_specified_clinit_body(
792
792
&class_to_declared_symbols_map)
793
793
{
794
794
const irep_idt &real_clinit_name = clinit_function_name (class_id);
795
+ const auto clinit_func = symbol_table.lookup (real_clinit_name);
796
+ if (clinit_func == nullptr )
797
+ {
798
+ // Case where the real clinit doesn't appear in the symbol table, even
799
+ // though their is user specifed one. This may occur when some class
800
+ // substitution happened after compilation.
801
+ return code_blockt{};
802
+ }
795
803
const auto class_entry =
796
804
static_values_json.find (id2string (strip_java_namespace_prefix (class_id)));
797
805
if (class_entry != static_values_json.end ())
@@ -817,13 +825,6 @@ code_blockt get_user_specified_clinit_body(
817
825
}
818
826
}
819
827
}
820
- if (symbol_table.lookup (real_clinit_name) == nullptr )
821
- {
822
- // Case where there is a user provided clinit, but the real clinit
823
- // doesn't appear in the symbol table. This may occur when some class
824
- // substitution happened after compilation.
825
- return code_blockt{};
826
- }
827
828
code_blockt body;
828
829
for (const auto &value_pair : static_field_values)
829
830
{
@@ -840,9 +841,7 @@ code_blockt get_user_specified_clinit_body(
840
841
return body;
841
842
}
842
843
}
843
- if (const auto clinit_func = symbol_table.lookup (real_clinit_name))
844
- return code_blockt{{code_function_callt{clinit_func->symbol_expr ()}}};
845
- return code_blockt{};
844
+ return code_blockt{{code_function_callt{clinit_func->symbol_expr ()}}};
846
845
}
847
846
848
847
// / Create static initializer wrappers and possibly user-specified functions for
0 commit comments