Skip to content

Commit 04895f3

Browse files
committed
Cleanup remove_function_pointers API
Remove unused variants and change the last parameter to become mandatory. Avoiding the default parameter ensures that upcoming changes to the list of parameters will not miss any call sites.
1 parent 8b53dba commit 04895f3

File tree

5 files changed

+10
-60
lines changed

5 files changed

+10
-60
lines changed

jbmc/src/jdiff/jdiff_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ bool jdiff_parse_optionst::process_goto_program(
173173
log.status() << "Removing function pointers and virtual functions"
174174
<< messaget::eom;
175175
remove_function_pointers(
176-
ui_message_handler, goto_model, cmdline.isset("pointer-check"));
176+
ui_message_handler, goto_model, cmdline.isset("pointer-check"), false);
177177

178178
// Java virtual functions -> explicit dispatch tables:
179179
remove_virtual_functions(goto_model);

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ void goto_instrument_parse_optionst::do_indirect_call_and_rtti_removal(
946946

947947
log.status() << "Function Pointer Removal" << messaget::eom;
948948
remove_function_pointers(
949-
ui_message_handler, goto_model, cmdline.isset("pointer-check"));
949+
ui_message_handler, goto_model, cmdline.isset("pointer-check"), false);
950950
log.status() << "Virtual function removal" << messaget::eom;
951951
remove_virtual_functions(goto_model);
952952
log.status() << "Cleaning inline assembler statements" << messaget::eom;

src/goto-programs/process_goto_program.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ bool process_goto_program(
4545
remove_function_pointers(
4646
log.get_message_handler(),
4747
goto_model,
48-
options.get_bool_option("pointer-check"));
48+
options.get_bool_option("pointer-check"),
49+
false);
4950

5051
mm_io(goto_model);
5152

src/goto-programs/remove_function_pointers.cpp

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -539,53 +539,18 @@ void remove_function_pointerst::operator()(goto_functionst &functions)
539539
functions.compute_location_numbers();
540540
}
541541

542-
bool remove_function_pointers(
543-
message_handlert &_message_handler,
544-
symbol_tablet &symbol_table,
545-
const goto_functionst &goto_functions,
546-
goto_programt &goto_program,
547-
const irep_idt &function_id,
548-
bool add_safety_assertion,
549-
bool only_remove_const_fps)
550-
{
551-
remove_function_pointerst
552-
rfp(
553-
_message_handler,
554-
symbol_table,
555-
add_safety_assertion,
556-
only_remove_const_fps,
557-
goto_functions);
558-
559-
return rfp.remove_function_pointers(goto_program, function_id);
560-
}
561-
562542
void remove_function_pointers(
563543
message_handlert &_message_handler,
564-
symbol_tablet &symbol_table,
565-
goto_functionst &goto_functions,
566-
bool add_safety_assertion,
567-
bool only_remove_const_fps)
568-
{
569-
remove_function_pointerst
570-
rfp(
571-
_message_handler,
572-
symbol_table,
573-
add_safety_assertion,
574-
only_remove_const_fps,
575-
goto_functions);
576-
577-
rfp(goto_functions);
578-
}
579-
580-
void remove_function_pointers(message_handlert &_message_handler,
581544
goto_modelt &goto_model,
582545
bool add_safety_assertion,
583546
bool only_remove_const_fps)
584547
{
585-
remove_function_pointers(
548+
remove_function_pointerst rfp(
586549
_message_handler,
587550
goto_model.symbol_table,
588-
goto_model.goto_functions,
589551
add_safety_assertion,
590-
only_remove_const_fps);
552+
only_remove_const_fps,
553+
goto_model.goto_functions);
554+
555+
rfp(goto_model.goto_functions);
591556
}

src/goto-programs/remove_function_pointers.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,7 @@ void remove_function_pointers(
2929
message_handlert &_message_handler,
3030
goto_modelt &goto_model,
3131
bool add_safety_assertion,
32-
bool only_remove_const_fps=false);
33-
34-
void remove_function_pointers(
35-
message_handlert &_message_handler,
36-
symbol_tablet &symbol_table,
37-
goto_functionst &goto_functions,
38-
bool add_safety_assertion,
39-
bool only_remove_const_fps=false);
40-
41-
bool remove_function_pointers(
42-
message_handlert &_message_handler,
43-
symbol_tablet &symbol_table,
44-
const goto_functionst &goto_functions,
45-
goto_programt &goto_program,
46-
const irep_idt &function_id,
47-
bool add_safety_assertion,
48-
bool only_remove_const_fps = false);
32+
bool only_remove_const_fps);
4933

5034
/// Replace a call to a dynamic function at location
5135
/// target in the given goto-program by a case-split

0 commit comments

Comments
 (0)