Skip to content

Commit 896cd66

Browse files
committed
Make messaget a member
remove_function_pointerst is not a logger, but instead it now has one. This avoids a somewhat surprising shadowing of an "mstream" class member, which really just is messaget's class member.
1 parent 23271d9 commit 896cd66

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/goto-programs/remove_function_pointers.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Author: Daniel Kroening, [email protected]
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
{
3535
public:
3636
remove_function_pointerst(
@@ -59,6 +59,7 @@ class remove_function_pointerst:public messaget
5959
const functionst &functions);
6060

6161
protected:
62+
messaget log;
6263
const namespacet ns;
6364
symbol_tablet &symbol_table;
6465
bool add_safety_assertion;
@@ -114,7 +115,7 @@ remove_function_pointerst::remove_function_pointerst(
114115
symbol_tablet &_symbol_table,
115116
bool _add_safety_assertion, bool only_resolve_const_fps,
116117
const goto_functionst &goto_functions):
117-
messaget(_message_handler),
118+
log(_message_handler),
118119
ns(_symbol_table),
119120
symbol_table(_symbol_table),
120121
add_safety_assertion(_add_safety_assertion),
@@ -304,15 +305,16 @@ void remove_function_pointerst::remove_function_pointer(
304305
const auto does_remove_const = const_removal_check();
305306
if(does_remove_const.first)
306307
{
307-
warning().source_location = does_remove_const.second;
308-
warning() << "cast from const to non-const pointer found, only worst case"
309-
<< " function pointer removal will be done." << eom;
308+
log.warning().source_location = does_remove_const.second;
309+
log.warning() << "cast from const to non-const pointer found, "
310+
<< "only worst case function pointer removal will be done."
311+
<< messaget::eom;
310312
found_functions=false;
311313
}
312314
else
313315
{
314316
remove_const_function_pointerst fpr(
315-
get_message_handler(), ns, symbol_table);
317+
log.get_message_handler(), ns, symbol_table);
316318

317319
found_functions=fpr(pointer, functions);
318320

@@ -455,14 +457,15 @@ void remove_function_pointerst::remove_function_pointer(
455457
target->type=OTHER;
456458

457459
// report statistics
458-
statistics().source_location=target->source_location;
459-
statistics() << "replacing function pointer by "
460-
<< functions.size() << " possible targets" << eom;
460+
log.statistics().source_location=target->source_location;
461+
log.statistics() << "replacing function pointer by "
462+
<< functions.size() << " possible targets"
463+
<< messaget::eom;
461464

462465
// list the names of functions when verbosity is at debug level
463-
conditional_output(
464-
debug(),
465-
[&functions](mstreamt &mstream) {
466+
log.conditional_output(
467+
log.debug(),
468+
[&functions](messaget::mstreamt &mstream) {
466469
mstream << "targets: ";
467470

468471
bool first = true;
@@ -475,7 +478,7 @@ void remove_function_pointerst::remove_function_pointer(
475478
first = false;
476479
}
477480

478-
mstream << eom;
481+
mstream << messaget::eom;
479482
});
480483
}
481484

0 commit comments

Comments
 (0)