Skip to content

Commit 8da5395

Browse files
Document cover functions
1 parent a7f0c3d commit 8da5395

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/goto-instrument/cover.cpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ Date: May 2016
1313

1414
#include "cover.h"
1515

16-
#include <iterator>
17-
#include <unordered_set>
18-
1916
#include <util/config.h>
20-
#include <util/cprover_prefix.h>
21-
#include <util/format_number_range.h>
2217
#include <util/message.h>
23-
#include <util/prefix.h>
2418
#include <util/make_unique.h>
2519

2620
#include "cover_basic_blocks.h"
2721
#include "cover_filter.h"
2822
#include "cover_instrument.h"
2923

24+
/// Applies instrumenters to given goto program
25+
/// \param goto_program: the goto program
26+
/// \param instrumenters: the instrumenters
27+
/// \param message_handler: a message handler
3028
void instrument_cover_goals(
3129
goto_programt &goto_program,
3230
const cover_instrumenterst &instrumenters,
@@ -40,6 +38,11 @@ void instrument_cover_goals(
4038
instrumenters(goto_program, basic_blocks);
4139
}
4240

41+
/// Instruments goto program for a given coverage criterion
42+
/// \param symbol_table: the symbol table
43+
/// \param goto_program: the goto program
44+
/// \param criterion: the coverage criterion
45+
/// \param message_handler: a message handler
4346
void instrument_cover_goals(
4447
const symbol_tablet &symbol_table,
4548
goto_programt &goto_program,
@@ -55,6 +58,10 @@ void instrument_cover_goals(
5558
instrument_cover_goals(goto_program, instrumenters, message_handler);
5659
}
5760

61+
/// Create and add an instrumenter based on the given criterion
62+
/// \param criterion: the coverage criterion
63+
/// \param symbol_table: the symbol table
64+
/// \param goal_filters: goal filters to discard certain goals
5865
void cover_instrumenterst::add_from_criterion(
5966
coverage_criteriont criterion,
6067
const symbol_tablet &symbol_table,
@@ -100,6 +107,9 @@ void cover_instrumenterst::add_from_criterion(
100107
}
101108
}
102109

110+
/// Parses a coverage criterion
111+
/// \param criterion_string: a string
112+
/// \return a coverage criterion or throws an exception
103113
coverage_criteriont
104114
parse_coverage_criterion(const std::string &criterion_string)
105115
{
@@ -131,6 +141,11 @@ parse_coverage_criterion(const std::string &criterion_string)
131141
return c;
132142
}
133143

144+
/// Applies instrumenters to given goto functions
145+
/// \param goto_functions: the goto functions
146+
/// \param instrumenters: the instrumenters
147+
/// \param function_filters: function filters to discard certain functions
148+
/// \param message_handler: a message handler
134149
void instrument_cover_goals(
135150
goto_functionst &goto_functions,
136151
const cover_instrumenterst &instrumenters,
@@ -146,6 +161,11 @@ void instrument_cover_goals(
146161
}
147162
}
148163

164+
/// Instruments goto functions based on given command line options
165+
/// \param cmdline: the command line
166+
/// \param symbol_table: the symbol table
167+
/// \param goto_functions: the goto functions
168+
/// \param message_handler: a message handler
149169
bool instrument_cover_goals(
150170
const cmdlinet &cmdline,
151171
const symbol_tablet &symbol_table,
@@ -258,6 +278,10 @@ bool instrument_cover_goals(
258278
return false;
259279
}
260280

281+
/// Instruments a goto model based on given command line options
282+
/// \param cmdline: the command line
283+
/// \param goto_model: the goto model
284+
/// \param message_handler: a message handler
261285
bool instrument_cover_goals(
262286
const cmdlinet &cmdline,
263287
goto_modelt &goto_model,

src/goto-instrument/cover.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ enum class coverage_criteriont
2929
PATH,
3030
MCDC,
3131
ASSERTION,
32-
COVER
32+
COVER // __CPROVER_cover(x) annotations
3333
};
3434

3535
void instrument_cover_goals(

0 commit comments

Comments
 (0)