20 if(instruction->incoming_edges.size() != 1)
25 in_t->is_goto() && !in_t->is_backwards_goto() &&
26 in_t->condition().is_true())
40 bool next_is_target =
true;
42 std::size_t current_block = 0;
52 bool end_of_assume_group =
59 if(next_is_target || it->is_target() || end_of_assume_group)
63 current_block = *block_number;
75 current_block <
block_infos.size(),
"current block number out of range");
84 !it->source_location().is_nil() &&
85 !it->source_location().get_file().empty() &&
86 !it->source_location().get_line().empty() &&
87 !it->source_location().is_built_in() &&
94 next_is_target = it->is_goto() || it->is_function_call();
95 preceding_assume = it->
is_assume() ? &*it :
nullptr;
106 std::optional<goto_programt::const_targett>
133 std::set<std::size_t> blocks_seen;
136 const std::size_t block_nr =
block_of(it);
140 blocks_seen.insert(block_nr).second &&
143 msg.
warning() <<
"Ignoring block " << (block_nr + 1) <<
" location "
145 <<
" (bytecode-index already instrumented)"
152 msg.
warning() <<
"Ignoring block " << (block_nr + 1) <<
" location "
153 << it->location_number <<
" " << function_id
164 out << block_pair.first->source_location() <<
" -> " << block_pair.second
173 const irep_idt &line = location.get_line();
182 if(!location.get_function().empty())
183 add_location(location);
192 const auto &location = it->source_location();
193 const auto &bytecode_index = location.get_java_bytecode_index();
211 const auto &bytecode_index = t->source_location().get_java_bytecode_index();
217 std::optional<goto_programt::const_targett>
cover_basic_blocks_javat(const goto_programt &_goto_program)
std::vector< goto_programt::const_targett > block_infos
const source_locationt & source_location_of(std::size_t block_number) const override
std::vector< source_locationt > block_locations
void output(std::ostream &out) const override
Outputs the list of blocks.
std::size_t block_of(goto_programt::const_targett t) const override
const source_linest & source_lines_of(std::size_t block_number) const override
std::vector< source_linest > block_source_lines
std::optional< goto_programt::const_targett > instruction_of(std::size_t block_number) const override
std::unordered_map< irep_idt, std::size_t > index_to_block
void output(std::ostream &out) const override
Outputs the list of blocks.
std::optional< goto_programt::const_targett > instruction_of(std::size_t block_nr) const override
static std::optional< std::size_t > continuation_of_block(const goto_programt::const_targett &instruction, block_mapt &block_map)
If this block is a continuation of a previous block through unconditional forward gotos,...
cover_basic_blockst(const goto_programt &goto_program)
std::map< goto_programt::const_targett, std::size_t, goto_programt::target_less_than > block_mapt
std::vector< block_infot > block_infos
map block numbers to block information
void report_block_anomalies(const irep_idt &function_id, const goto_programt &goto_program, message_handlert &message_handler) override
Output warnings about ignored blocks.
const source_linest & source_lines_of(std::size_t block_nr) const override
std::size_t block_of(goto_programt::const_targett t) const override
static void add_block_lines(cover_basic_blockst::block_infot &block, const goto_programt::instructiont &instruction)
Adds the lines which instruction spans to block.
const source_locationt & source_location_of(std::size_t block_nr) const override
block_mapt block_map
map program locations to block numbers
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
const source_locationt & source_location() const
void visit_pre(std::function< void(exprt &)>)
This class represents an instruction in the GOTO intermediate representation.
const goto_instruction_codet & code() const
Get the code represented by this instruction.
const source_locationt & source_location() const
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
instructionst::iterator targett
instructionst::const_iterator const_targett
source_locationt source_location
Class that provides messages with a built-in verbosity 'level'.
mstreamt & warning() const
void insert(const source_locationt &loc)
Insert a line (a source location) into the set of lines.
static const source_locationt & nil()
const irep_idt & get_line() const
const irep_idt & get_file() const
static bool same_source_line(const source_locationt &a, const source_locationt &b)
Basic blocks detection for Coverage Instrumentation.
#define forall_goto_program_instructions(it, program)
#define PRECONDITION(CONDITION)
std::optional< goto_programt::const_targett > representative_inst
the program location to instrument for this block
source_locationt source_location
the source location representative for this block (we need a separate copy of source locations becaus...
source_linest source_lines
the set of source code lines belonging to this block