Skip to content

Commit 254f133

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#1323 from janmroczkowski/janmroczkowski/goto_modelt-output-const
Make output methods const
2 parents 34492db + 388a25e commit 254f133

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

src/analyses/uncaught_exceptions_analysis.cpp

Lines changed: 10 additions & 7 deletions
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

Lines changed: 1 addition & 1 deletion
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 &,

src/goto-instrument/accelerate/path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class path_nodet
3636
{
3737
}
3838

39-
void output(const goto_programt &program, std::ostream &str);
39+
void output(const goto_programt &program, std::ostream &str) const;
4040

4141
goto_programt::targett loc;
4242
const exprt guard;

src/goto-instrument/accelerate/trace_automaton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ void trace_automatont::minimise()
473473
determinise();
474474
}
475475

476-
void automatont::output(std::ostream &str)
476+
void automatont::output(std::ostream &str) const
477477
{
478478
str << "Init: " << init_state << '\n';
479479

src/goto-instrument/accelerate/trace_automaton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class automatont
5454

5555
std::size_t count_transitions();
5656

57-
void output(std::ostream &str);
57+
void output(std::ostream &str) const;
5858

5959
void clear()
6060
{

src/goto-instrument/cover.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Date: May 2016
2828
#include <json/json_parser.h>
2929
#include <util/message.h>
3030

31+
namespace
32+
{
3133
class basic_blockst
3234
{
3335
public:
@@ -237,7 +239,7 @@ class basic_blockst
237239
}
238240
}
239241

240-
void output(std::ostream &out)
242+
void output(std::ostream &out) const
241243
{
242244
for(block_mapt::const_iterator
243245
b_it=block_map.begin();
@@ -289,6 +291,7 @@ class basic_blockst
289291
block_info.source_location.set_basic_block_covered_lines(covered_lines);
290292
}
291293
};
294+
}
292295

293296
bool coverage_goalst::get_coverage_goals(
294297
const std::string &coverage_file,

src/goto-programs/goto_model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class goto_modelt
3131
goto_functions.clear();
3232
}
3333

34-
void output(std::ostream &out)
34+
void output(std::ostream &out) const
3535
{
3636
namespacet ns(symbol_table);
3737
goto_functions.output(ns, out);

0 commit comments

Comments
 (0)