@@ -44,6 +44,20 @@ class remove_function_pointerst:public messaget
44
44
45
45
bool remove_function_pointers (goto_programt &goto_program);
46
46
47
+ // a set of function symbols
48
+ using functionst = remove_const_function_pointerst::functionst;
49
+
50
+ // / Replace a call to a dynamic function at location
51
+ // / target in the given goto-program by a case-split
52
+ // / over a given set of functions
53
+ // / \param goto_program The goto program that contains target
54
+ // / \param target location with function call with function pointer
55
+ // / \param functions The set of functions to consider
56
+ void remove_function_pointer (
57
+ goto_programt &goto_program,
58
+ goto_programt::targett target,
59
+ const functionst &functions);
60
+
47
61
protected:
48
62
const namespacet ns;
49
63
symbol_tablet &symbol_table;
@@ -57,6 +71,11 @@ class remove_function_pointerst:public messaget
57
71
// --remove-const-function-pointers instead of --remove-function-pointers
58
72
bool only_resolve_const_fps;
59
73
74
+ // / Replace a call to a dynamic function at location
75
+ // / target in the given goto-program by determining
76
+ // / functions that have a compatible signature
77
+ // / \param goto_program The goto program that contains target
78
+ // / \param target location with function call with function pointer
60
79
void remove_function_pointer (
61
80
goto_programt &goto_program,
62
81
goto_programt::targett target);
@@ -348,6 +367,19 @@ void remove_function_pointerst::remove_function_pointer(
348
367
}
349
368
}
350
369
370
+ remove_function_pointer (goto_program, target, functions);
371
+ }
372
+
373
+ void remove_function_pointerst::remove_function_pointer (
374
+ goto_programt &goto_program,
375
+ goto_programt::targett target,
376
+ const functionst &functions)
377
+ {
378
+ const code_function_callt &code = to_code_function_call (target->code );
379
+
380
+ const exprt &function = code.function ();
381
+ const exprt &pointer = to_dereference_expr (function).pointer ();
382
+
351
383
// the final target is a skip
352
384
goto_programt final_skip;
353
385
0 commit comments