Skip to content

Make output methods const #1323

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
Show file tree
Hide file tree
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
17 changes: 10 additions & 7 deletions src/analyses/uncaught_exceptions_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,22 @@ void uncaught_exceptions_analysist::collect_uncaught_exceptions(
/// Prints the exceptions map that maps each method to the set of exceptions
/// that may escape it
void uncaught_exceptions_analysist::output(
const goto_functionst &goto_functions)
const goto_functionst &goto_functions) const
{
#ifdef DEBUG
forall_goto_functions(it, goto_functions)
{
if(exceptions_map[it->first].size()>0)
const auto fn=it->first;
const exceptions_mapt::const_iterator found=exceptions_map.find(fn);
INVARIANT(
found!=exceptions_map.end(),
"each function expected to be recorded in `exceptions_map`");
const auto &fs=found->second;
if(!fs.empty())
{
std::cout << "Uncaught exceptions in function " <<
it->first << ": " << std::endl;
INVARIANT(
exceptions_map.find(it->first)!=exceptions_map.end(),
"each function expected to be recorded in `exceptions_map`");
for(auto exc_id : exceptions_map[it->first])
fn << ": " << std::endl;
for(const auto exc_id : fs)
std::cout << id2string(exc_id) << " ";
std::cout << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/uncaught_exceptions_analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class uncaught_exceptions_analysist
const goto_functionst &,
const namespacet &);

void output(const goto_functionst &);
void output(const goto_functionst &) const;

void operator()(
const goto_functionst &,
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/accelerate/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class path_nodet
{
}

void output(const goto_programt &program, std::ostream &str);
void output(const goto_programt &program, std::ostream &str) const;

goto_programt::targett loc;
const exprt guard;
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/accelerate/trace_automaton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ void trace_automatont::minimise()
determinise();
}

void automatont::output(std::ostream &str)
void automatont::output(std::ostream &str) const
{
str << "Init: " << init_state << '\n';

Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/accelerate/trace_automaton.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class automatont

std::size_t count_transitions();

void output(std::ostream &str);
void output(std::ostream &str) const;

void clear()
{
Expand Down
5 changes: 4 additions & 1 deletion src/goto-instrument/cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Date: May 2016
#include <json/json_parser.h>
#include <util/message.h>

namespace
{
class basic_blockst
{
public:
Expand Down Expand Up @@ -237,7 +239,7 @@ class basic_blockst
}
}

void output(std::ostream &out)
void output(std::ostream &out) const
{
for(block_mapt::const_iterator
b_it=block_map.begin();
Expand Down Expand Up @@ -289,6 +291,7 @@ class basic_blockst
block_info.source_location.set_basic_block_covered_lines(covered_lines);
}
};
}

bool coverage_goalst::get_coverage_goals(
const std::string &coverage_file,
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/goto_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class goto_modelt
goto_functions.clear();
}

void output(std::ostream &out)
void output(std::ostream &out) const
{
namespacet ns(symbol_table);
goto_functions.output(ns, out);
Expand Down