@@ -642,7 +642,8 @@ int jbmc_parse_optionst::get_goto_program(
642642}
643643
644644void jbmc_parse_optionst::process_goto_function (
645- goto_model_functiont &function)
645+ goto_model_functiont &function,
646+ const can_produce_functiont &available_functions)
646647{
647648 symbol_tablet &symbol_table = function.get_symbol_table ();
648649 goto_functionst::goto_functiont &goto_function = function.get_goto_function ();
@@ -655,6 +656,14 @@ void jbmc_parse_optionst::process_goto_function(
655656 remove_instanceof (goto_function, symbol_table);
656657 // Java virtual functions -> explicit dispatch tables:
657658 remove_virtual_functions (function);
659+
660+ auto function_is_stub =
661+ [&symbol_table, &available_functions](const irep_idt &id) { // NOLINT(*)
662+ return symbol_table.lookup_ref (id).value .is_nil () &&
663+ !available_functions.can_produce_function (id);
664+ };
665+
666+ remove_returns (function, function_is_stub);
658667 }
659668
660669 catch (const char *e)
@@ -692,9 +701,6 @@ bool jbmc_parse_optionst::process_goto_functions(
692701 // instrument library preconditions
693702 instrument_preconditions (goto_model);
694703
695- // remove returns, gcc vectors, complex
696- remove_returns (goto_model);
697-
698704 // Similar removal of java nondet statements:
699705 // TODO Should really get this from java_bytecode_language somehow, but we
700706 // don't have an instance of that here.
0 commit comments