Skip to content

Commit 8bfb45f

Browse files
committed
Rename and make static remove_virtual_function
The rename is just to disambiguate from the public entry point that calls it (and which additionally does a goto_programt::update). Making this static means we no longer have to needlessly calculate a class_hierarchyt to call it.
1 parent 098ba56 commit 8bfb45f

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ class remove_virtual_functionst
7676
const irep_idt &function_id,
7777
goto_programt &goto_program);
7878

79-
goto_programt::targett remove_virtual_function(
80-
const irep_idt &function_id,
81-
goto_programt &goto_program,
82-
goto_programt::targett target,
83-
const dispatch_table_entriest &functions,
84-
virtual_dispatch_fallback_actiont fallback_action);
85-
8679
private:
8780
const class_hierarchyt &class_hierarchy;
8881
symbol_table_baset &symbol_table;
@@ -249,6 +242,7 @@ static void process_this_argument(
249242
/// implementation. If there's a type mismatch between implementation
250243
/// and the instance type or if fallback_action is set to
251244
/// ASSUME_FALSE, then function is substituted with a call to ASSUME(false)
245+
/// \param symbol_table: Symbol table associated with \p goto_program
252246
/// \param function_id: The identifier of the function we are currently
253247
/// analysing
254248
/// \param [in,out] goto_program: GOTO program to modify
@@ -261,7 +255,8 @@ static void process_this_argument(
261255
/// with the most derived matching call
262256
/// \return Returns a pointer to the statement in the supplied GOTO
263257
/// program after replaced function call
264-
goto_programt::targett remove_virtual_functionst::remove_virtual_function(
258+
static goto_programt::targett replace_virtual_function_with_dispatch_table(
259+
symbol_table_baset &symbol_table,
265260
const irep_idt &function_id,
266261
goto_programt &goto_program,
267262
goto_programt::targett target,
@@ -272,6 +267,7 @@ goto_programt::targett remove_virtual_functionst::remove_virtual_function(
272267
target->is_function_call(),
273268
"remove_virtual_function must target a FUNCTION_CALL instruction");
274269

270+
namespacet ns(symbol_table);
275271
goto_programt::targett next_target = std::next(target);
276272

277273
if(functions.empty())
@@ -491,7 +487,8 @@ goto_programt::targett remove_virtual_functionst::remove_virtual_function(
491487
dispatch_table_entriest functions;
492488
get_callees.get_functions(function, functions);
493489

494-
return remove_virtual_function(
490+
return replace_virtual_function_with_dispatch_table(
491+
symbol_table,
495492
function_id,
496493
goto_program,
497494
target,
@@ -793,12 +790,13 @@ goto_programt::targett remove_virtual_function(
793790
const dispatch_table_entriest &dispatch_table,
794791
virtual_dispatch_fallback_actiont fallback_action)
795792
{
796-
class_hierarchyt class_hierarchy;
797-
class_hierarchy(symbol_table);
798-
remove_virtual_functionst rvf(symbol_table, class_hierarchy);
799-
800-
goto_programt::targett next = rvf.remove_virtual_function(
801-
function_id, goto_program, instruction, dispatch_table, fallback_action);
793+
goto_programt::targett next = replace_virtual_function_with_dispatch_table(
794+
symbol_table,
795+
function_id,
796+
goto_program,
797+
instruction,
798+
dispatch_table,
799+
fallback_action);
802800

803801
goto_program.update();
804802

0 commit comments

Comments
 (0)