30
30
#include " compute_called_functions.h"
31
31
#include " remove_const_function_pointers.h"
32
32
33
- class remove_function_pointerst : public messaget
33
+ class remove_function_pointerst
34
34
{
35
35
public:
36
36
remove_function_pointerst (
@@ -59,6 +59,7 @@ class remove_function_pointerst:public messaget
59
59
const functionst &functions);
60
60
61
61
protected:
62
+ messaget log;
62
63
const namespacet ns;
63
64
symbol_tablet &symbol_table;
64
65
bool add_safety_assertion;
@@ -103,13 +104,14 @@ class remove_function_pointerst:public messaget
103
104
remove_function_pointerst::remove_function_pointerst (
104
105
message_handlert &_message_handler,
105
106
symbol_tablet &_symbol_table,
106
- bool _add_safety_assertion, bool only_resolve_const_fps,
107
- const goto_functionst &goto_functions):
108
- messaget(_message_handler),
109
- ns(_symbol_table),
110
- symbol_table(_symbol_table),
111
- add_safety_assertion(_add_safety_assertion),
112
- only_resolve_const_fps(only_resolve_const_fps)
107
+ bool _add_safety_assertion,
108
+ bool only_resolve_const_fps,
109
+ const goto_functionst &goto_functions)
110
+ : log(_message_handler),
111
+ ns(_symbol_table),
112
+ symbol_table(_symbol_table),
113
+ add_safety_assertion(_add_safety_assertion),
114
+ only_resolve_const_fps(only_resolve_const_fps)
113
115
{
114
116
for (const auto &s : symbol_table.symbols )
115
117
compute_address_taken_functions (s.second .value , address_taken);
@@ -297,15 +299,16 @@ void remove_function_pointerst::remove_function_pointer(
297
299
const auto does_remove_const = const_removal_check ();
298
300
if (does_remove_const.first )
299
301
{
300
- warning ().source_location = does_remove_const.second ;
301
- warning () << " cast from const to non-const pointer found, only worst case"
302
- << " function pointer removal will be done." << eom;
302
+ log .warning ().source_location = does_remove_const.second ;
303
+ log .warning () << " cast from const to non-const pointer found, "
304
+ << " only worst case function pointer removal will be done."
305
+ << messaget::eom;
303
306
found_functions=false ;
304
307
}
305
308
else
306
309
{
307
310
remove_const_function_pointerst fpr (
308
- get_message_handler (), ns, symbol_table);
311
+ log . get_message_handler (), ns, symbol_table);
309
312
310
313
found_functions=fpr (pointer, functions);
311
314
@@ -448,14 +451,13 @@ void remove_function_pointerst::remove_function_pointer(
448
451
target->type =OTHER;
449
452
450
453
// report statistics
451
- statistics ().source_location = target->source_location ;
452
- statistics () << " replacing function pointer by "
453
- << functions. size () << " possible targets" << eom;
454
+ log . statistics ().source_location = target->source_location ;
455
+ log . statistics () << " replacing function pointer by " << functions. size ()
456
+ << " possible targets" << messaget:: eom;
454
457
455
458
// list the names of functions when verbosity is at debug level
456
- conditional_output (
457
- debug (),
458
- [&functions](mstreamt &mstream) {
459
+ log .conditional_output (
460
+ log .debug (), [&functions](messaget::mstreamt &mstream) {
459
461
mstream << " targets: " ;
460
462
461
463
bool first = true ;
@@ -468,7 +470,7 @@ void remove_function_pointerst::remove_function_pointer(
468
470
first = false ;
469
471
}
470
472
471
- mstream << eom;
473
+ mstream << messaget:: eom;
472
474
});
473
475
}
474
476
0 commit comments