Skip to content

Commit 5131939

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 5131939

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/goto-programs/remove_function_pointers.cpp

Lines changed: 21 additions & 19 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;
@@ -112,13 +113,14 @@ class remove_function_pointerst:public messaget
112113
remove_function_pointerst::remove_function_pointerst(
113114
message_handlert &_message_handler,
114115
symbol_tablet &_symbol_table,
115-
bool _add_safety_assertion, bool only_resolve_const_fps,
116-
const goto_functionst &goto_functions):
117-
messaget(_message_handler),
118-
ns(_symbol_table),
119-
symbol_table(_symbol_table),
120-
add_safety_assertion(_add_safety_assertion),
121-
only_resolve_const_fps(only_resolve_const_fps)
116+
bool _add_safety_assertion,
117+
bool only_resolve_const_fps,
118+
const goto_functionst &goto_functions)
119+
: log(_message_handler),
120+
ns(_symbol_table),
121+
symbol_table(_symbol_table),
122+
add_safety_assertion(_add_safety_assertion),
123+
only_resolve_const_fps(only_resolve_const_fps)
122124
{
123125
compute_address_taken_in_symbols(address_taken);
124126
compute_address_taken_functions(goto_functions, address_taken);
@@ -304,15 +306,16 @@ void remove_function_pointerst::remove_function_pointer(
304306
const auto does_remove_const = const_removal_check();
305307
if(does_remove_const.first)
306308
{
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;
309+
log.warning().source_location = does_remove_const.second;
310+
log.warning() << "cast from const to non-const pointer found, "
311+
<< "only worst case function pointer removal will be done."
312+
<< messaget::eom;
310313
found_functions=false;
311314
}
312315
else
313316
{
314317
remove_const_function_pointerst fpr(
315-
get_message_handler(), ns, symbol_table);
318+
log.get_message_handler(), ns, symbol_table);
316319

317320
found_functions=fpr(pointer, functions);
318321

@@ -455,14 +458,13 @@ void remove_function_pointerst::remove_function_pointer(
455458
target->type=OTHER;
456459

457460
// report statistics
458-
statistics().source_location=target->source_location;
459-
statistics() << "replacing function pointer by "
460-
<< functions.size() << " possible targets" << eom;
461+
log.statistics().source_location = target->source_location;
462+
log.statistics() << "replacing function pointer by " << functions.size()
463+
<< " possible targets" << 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(), [&functions](messaget::mstreamt &mstream) {
466468
mstream << "targets: ";
467469

468470
bool first = true;
@@ -475,7 +477,7 @@ void remove_function_pointerst::remove_function_pointer(
475477
first = false;
476478
}
477479

478-
mstream << eom;
480+
mstream << messaget::eom;
479481
});
480482
}
481483

0 commit comments

Comments
 (0)