11
11
#include < algorithm>
12
12
13
13
#include " remove_virtual_functions.h"
14
- #include " class_hierarchy.h"
15
14
#include " class_identifier.h"
16
15
17
16
#include < goto-programs/resolve_concrete_function_call.h>
@@ -24,7 +23,8 @@ class remove_virtual_functionst
24
23
{
25
24
public:
26
25
remove_virtual_functionst (
27
- const symbol_tablet &_symbol_table);
26
+ const symbol_tablet &_symbol_table,
27
+ const class_hierarchyt &_class_hierarchy);
28
28
29
29
void operator ()(goto_functionst &goto_functions);
30
30
@@ -40,13 +40,14 @@ class remove_virtual_functionst
40
40
const namespacet ns;
41
41
const symbol_tablet &symbol_table;
42
42
43
- class_hierarchyt class_hierarchy;
43
+ const class_hierarchyt & class_hierarchy;
44
44
45
45
void remove_virtual_function (
46
46
goto_programt &goto_program,
47
47
goto_programt::targett target);
48
-
48
+ public:
49
49
void get_functions (const exprt &, dispatch_table_entriest &);
50
+ protected:
50
51
typedef std::function<
51
52
resolve_concrete_function_callt::concrete_function_callt (
52
53
const irep_idt &,
@@ -64,11 +65,12 @@ class remove_virtual_functionst
64
65
};
65
66
66
67
remove_virtual_functionst::remove_virtual_functionst (
67
- const symbol_tablet &_symbol_table):
68
+ const symbol_tablet &_symbol_table,
69
+ const class_hierarchyt &_class_hierarchy):
68
70
ns(_symbol_table),
69
- symbol_table(_symbol_table)
71
+ symbol_table(_symbol_table),
72
+ class_hierarchy(_class_hierarchy)
70
73
{
71
- class_hierarchy (symbol_table);
72
74
}
73
75
74
76
void remove_virtual_functionst::remove_virtual_function (
@@ -434,7 +436,9 @@ void remove_virtual_functions(
434
436
const symbol_tablet &symbol_table,
435
437
goto_functionst &goto_functions)
436
438
{
437
- remove_virtual_functionst rvf (symbol_table);
439
+ class_hierarchyt class_hierarchy;
440
+ class_hierarchy (symbol_table);
441
+ remove_virtual_functionst rvf (symbol_table, class_hierarchy);
438
442
rvf (goto_functions);
439
443
}
440
444
@@ -446,7 +450,9 @@ void remove_virtual_functions(goto_modelt &goto_model)
446
450
447
451
void remove_virtual_functions (goto_model_functiont &function)
448
452
{
449
- remove_virtual_functionst rvf (function.get_symbol_table ());
453
+ class_hierarchyt class_hierarchy;
454
+ class_hierarchy (function.get_symbol_table ());
455
+ remove_virtual_functionst rvf (function.get_symbol_table (), class_hierarchy);
450
456
bool changed = rvf.remove_virtual_functions (
451
457
function.get_goto_function ().body );
452
458
// Give fresh location numbers to `function`, in case it has grown:
@@ -461,8 +467,20 @@ void remove_virtual_function(
461
467
const dispatch_table_entriest &dispatch_table,
462
468
virtual_dispatch_fallback_actiont fallback_action)
463
469
{
464
- remove_virtual_functionst rvf (goto_model.symbol_table );
470
+ class_hierarchyt class_hierarchy;
471
+ class_hierarchy (goto_model.symbol_table );
472
+ remove_virtual_functionst rvf (goto_model.symbol_table , class_hierarchy);
465
473
466
474
rvf.remove_virtual_function (
467
475
goto_program, instruction, dispatch_table, fallback_action);
468
476
}
477
+
478
+ void get_overridden_functions (
479
+ const exprt &function,
480
+ const symbol_tablet &symbol_table,
481
+ const class_hierarchyt &class_hierarchy,
482
+ dispatch_table_entriest &overridden_functions)
483
+ {
484
+ remove_virtual_functionst instance (symbol_table, class_hierarchy);
485
+ instance.get_functions (function, overridden_functions);
486
+ }
0 commit comments