Skip to content

Commit

Permalink
Make uncaught_exceptions_analysis.output const
Browse files Browse the repository at this point in the history
  • Loading branch information
janmroczkowski committed Sep 6, 2017
1 parent 211fcc2 commit 388a25e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
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

0 comments on commit 388a25e

Please sign in to comment.