Skip to content

Commit

Permalink
Pass ostream instead of using cout in natural_loops
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschrammel committed Sep 15, 2017
1 parent 58b75cf commit 3d4c794
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/analyses/natural_loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ Author: Georg Weissenbacher, [email protected]

#include "natural_loops.h"

#include <iostream>

void show_natural_loops(const goto_modelt &goto_model)
void show_natural_loops(
const goto_modelt &goto_model,
std::ostream &out)
{
forall_goto_functions(it, goto_model.goto_functions)
{
std::cout << "*** " << it->first << '\n';
out << "*** " << it->first << '\n';

natural_loopst natural_loops;
natural_loops(it->second.body);
natural_loops.output(std::cout);
natural_loops.output(out);

std::cout << '\n';
out << '\n';
}
}
4 changes: 3 additions & 1 deletion src/analyses/natural_loops.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class natural_loopst:
typedef natural_loops_templatet<goto_programt, goto_programt::targett>
natural_loops_mutablet;

void show_natural_loops(const goto_modelt &);
void show_natural_loops(
const goto_modelt &,
std::ostream &out);

/// Finds all back-edges and computes the natural loops
#ifdef DEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ int goto_instrument_parse_optionst::doit()

if(cmdline.isset("show-natural-loops"))
{
show_natural_loops(goto_model);
show_natural_loops(goto_model, std::cout);
return 0;
}

Expand Down

0 comments on commit 3d4c794

Please sign in to comment.