Skip to content

Commit 388a25e

Browse files
author
janmroczkowski
committed
Make uncaught_exceptions_analysis.output const
1 parent 211fcc2 commit 388a25e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/analyses/uncaught_exceptions_analysis.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,22 @@ void uncaught_exceptions_analysist::collect_uncaught_exceptions(
186186
/// Prints the exceptions map that maps each method to the set of exceptions
187187
/// that may escape it
188188
void uncaught_exceptions_analysist::output(
189-
const goto_functionst &goto_functions)
189+
const goto_functionst &goto_functions) const
190190
{
191191
#ifdef DEBUG
192192
forall_goto_functions(it, goto_functions)
193193
{
194-
if(exceptions_map[it->first].size()>0)
194+
const auto fn=it->first;
195+
const exceptions_mapt::const_iterator found=exceptions_map.find(fn);
196+
INVARIANT(
197+
found!=exceptions_map.end(),
198+
"each function expected to be recorded in `exceptions_map`");
199+
const auto &fs=found->second;
200+
if(!fs.empty())
195201
{
196202
std::cout << "Uncaught exceptions in function " <<
197-
it->first << ": " << std::endl;
198-
INVARIANT(
199-
exceptions_map.find(it->first)!=exceptions_map.end(),
200-
"each function expected to be recorded in `exceptions_map`");
201-
for(auto exc_id : exceptions_map[it->first])
203+
fn << ": " << std::endl;
204+
for(const auto exc_id : fs)
202205
std::cout << id2string(exc_id) << " ";
203206
std::cout << std::endl;
204207
}

src/analyses/uncaught_exceptions_analysis.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class uncaught_exceptions_analysist
6464
const goto_functionst &,
6565
const namespacet &);
6666

67-
void output(const goto_functionst &);
67+
void output(const goto_functionst &) const;
6868

6969
void operator()(
7070
const goto_functionst &,

0 commit comments

Comments
 (0)