@@ -30,7 +30,7 @@ Author: Daniel Kroening, kroening@kroening.com
3030#include " compute_called_functions.h"
3131#include " remove_const_function_pointers.h"
3232
33- class remove_function_pointerst : public messaget
33+ class remove_function_pointerst
3434{
3535public:
3636 remove_function_pointerst (
@@ -59,6 +59,7 @@ class remove_function_pointerst:public messaget
5959 const functionst &functions);
6060
6161protected:
62+ messaget log;
6263 const namespacet ns;
6364 symbol_tablet &symbol_table;
6465 bool add_safety_assertion;
@@ -103,13 +104,14 @@ class remove_function_pointerst:public messaget
103104remove_function_pointerst::remove_function_pointerst (
104105 message_handlert &_message_handler,
105106 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)
113115{
114116 for (const auto &s : symbol_table.symbols )
115117 compute_address_taken_functions (s.second .value , address_taken);
@@ -297,15 +299,16 @@ void remove_function_pointerst::remove_function_pointer(
297299 const auto does_remove_const = const_removal_check ();
298300 if (does_remove_const.first )
299301 {
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;
303306 found_functions=false ;
304307 }
305308 else
306309 {
307310 remove_const_function_pointerst fpr (
308- get_message_handler (), ns, symbol_table);
311+ log. get_message_handler (), ns, symbol_table);
309312
310313 found_functions=fpr (pointer, functions);
311314
@@ -448,14 +451,13 @@ void remove_function_pointerst::remove_function_pointer(
448451 target->type =OTHER;
449452
450453 // 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;
454457
455458 // 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) {
459461 mstream << " targets: " ;
460462
461463 bool first = true ;
@@ -468,7 +470,7 @@ void remove_function_pointerst::remove_function_pointer(
468470 first = false ;
469471 }
470472
471- mstream << eom;
473+ mstream << messaget:: eom;
472474 });
473475}
474476
0 commit comments