Skip to content

Commit 07b415a

Browse files
Make update_covered_lines a static function
This does not need to be exposed in the interface of the class, and is only working on the block_info member.
1 parent c88a26e commit 07b415a

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/goto-instrument/cover_basic_blocks.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Author: Peter Schrammel
1515
#include <util/message.h>
1616
#include <util/string2int.h>
1717

18+
/// create list of covered lines as CSV string and set as property of source
19+
/// location of basic block, compress to ranges if applicable
20+
static void update_covered_lines(cover_basic_blockst::block_infot &block_info);
21+
1822
cover_basic_blockst::cover_basic_blockst(const goto_programt &_goto_program)
1923
{
2024
bool next_is_target = true;
@@ -214,7 +218,7 @@ void cover_basic_blockst::output(std::ostream &out) const
214218
<< '\n';
215219
}
216220

217-
void cover_basic_blockst::update_covered_lines(block_infot &block_info)
221+
static void update_covered_lines(cover_basic_blockst::block_infot &block_info)
218222
{
219223
if(block_info.source_location.is_nil())
220224
return;

src/goto-instrument/cover_basic_blocks.h

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ class message_handlert;
2121
class cover_basic_blockst
2222
{
2323
public:
24+
struct block_infot
25+
{
26+
/// the program location to instrument for this block
27+
optionalt<goto_programt::const_targett> representative_inst;
28+
29+
/// the source location representative for this block
30+
// (we need a separate copy of source locations because we attach
31+
// the line number ranges to them)
32+
source_locationt source_location;
33+
34+
// map block numbers to source code locations
35+
/// the set of lines belonging to this block
36+
std::unordered_set<unsigned> lines;
37+
};
38+
2439
explicit cover_basic_blockst(const goto_programt &_goto_program);
2540

2641
/// \param t a goto instruction
@@ -62,27 +77,9 @@ class cover_basic_blockst
6277
typedef std::map<goto_programt::const_targett, unsigned> block_mapt;
6378
block_mapt block_map;
6479

65-
struct block_infot
66-
{
67-
/// the program location to instrument for this block
68-
optionalt<goto_programt::const_targett> representative_inst;
69-
70-
/// the source location representative for this block
71-
// (we need a separate copy of source locations because we attach
72-
// the line number ranges to them)
73-
source_locationt source_location;
74-
75-
// map block numbers to source code locations
76-
/// the set of lines belonging to this block
77-
std::unordered_set<unsigned> lines;
78-
};
79-
8080
typedef std::vector<block_infot> block_infost;
8181
block_infost block_infos;
8282

83-
/// create list of covered lines as CSV string and set as property of source
84-
/// location of basic block, compress to ranges if applicable
85-
void update_covered_lines(block_infot &block_info);
8683
};
8784

8885
#endif // CPROVER_GOTO_INSTRUMENT_COVER_BASIC_BLOCKS_H

0 commit comments

Comments
 (0)