Skip to content

Make messaget a member [blocks: #2310] #3378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions src/goto-programs/remove_function_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Author: Daniel Kroening, [email protected]
#include "compute_called_functions.h"
#include "remove_const_function_pointers.h"

class remove_function_pointerst:public messaget
class remove_function_pointerst
{
public:
remove_function_pointerst(
Expand Down Expand Up @@ -59,6 +59,7 @@ class remove_function_pointerst:public messaget
const functionst &functions);

protected:
messaget log;
const namespacet ns;
symbol_tablet &symbol_table;
bool add_safety_assertion;
Expand Down Expand Up @@ -112,13 +113,14 @@ class remove_function_pointerst:public messaget
remove_function_pointerst::remove_function_pointerst(
message_handlert &_message_handler,
symbol_tablet &_symbol_table,
bool _add_safety_assertion, bool only_resolve_const_fps,
const goto_functionst &goto_functions):
messaget(_message_handler),
ns(_symbol_table),
symbol_table(_symbol_table),
add_safety_assertion(_add_safety_assertion),
only_resolve_const_fps(only_resolve_const_fps)
bool _add_safety_assertion,
bool only_resolve_const_fps,
const goto_functionst &goto_functions)
: log(_message_handler),
ns(_symbol_table),
symbol_table(_symbol_table),
add_safety_assertion(_add_safety_assertion),
only_resolve_const_fps(only_resolve_const_fps)
{
compute_address_taken_in_symbols(address_taken);
compute_address_taken_functions(goto_functions, address_taken);
Expand Down Expand Up @@ -304,15 +306,16 @@ void remove_function_pointerst::remove_function_pointer(
const auto does_remove_const = const_removal_check();
if(does_remove_const.first)
{
warning().source_location = does_remove_const.second;
warning() << "cast from const to non-const pointer found, only worst case"
<< " function pointer removal will be done." << eom;
log.warning().source_location = does_remove_const.second;
log.warning() << "cast from const to non-const pointer found, "
<< "only worst case function pointer removal will be done."
<< messaget::eom;
found_functions=false;
}
else
{
remove_const_function_pointerst fpr(
get_message_handler(), ns, symbol_table);
log.get_message_handler(), ns, symbol_table);

found_functions=fpr(pointer, functions);

Expand Down Expand Up @@ -455,14 +458,13 @@ void remove_function_pointerst::remove_function_pointer(
target->type=OTHER;

// report statistics
statistics().source_location=target->source_location;
statistics() << "replacing function pointer by "
<< functions.size() << " possible targets" << eom;
log.statistics().source_location = target->source_location;
log.statistics() << "replacing function pointer by " << functions.size()
<< " possible targets" << messaget::eom;

// list the names of functions when verbosity is at debug level
conditional_output(
debug(),
[&functions](mstreamt &mstream) {
log.conditional_output(
log.debug(), [&functions](messaget::mstreamt &mstream) {
mstream << "targets: ";

bool first = true;
Expand All @@ -475,7 +477,7 @@ void remove_function_pointerst::remove_function_pointer(
first = false;
}

mstream << eom;
mstream << messaget::eom;
});
}

Expand Down