File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,7 @@ cover_basic_blockst::cover_basic_blockst(const goto_programt &goto_program)
5858
5959 block_map[it] = current_block;
6060
61- // update lines belonging to block
62- const irep_idt &line = it->source_location .get_line ();
63- if (!line.empty ())
64- {
65- block_info.lines .insert (unsafe_string2unsigned (id2string (line)));
66- block_info.source_lines .insert (it->source_location );
67- }
61+ add_block_lines (block_info, *it);
6862
6963 // set representative program location to instrument
7064 if (
@@ -155,6 +149,18 @@ void cover_basic_blockst::output(std::ostream &out) const
155149 << ' \n ' ;
156150}
157151
152+ void cover_basic_blockst::add_block_lines (
153+ cover_basic_blockst::block_infot &block,
154+ const goto_programt::instructiont &instruction)
155+ {
156+ const irep_idt &line = instruction.source_location .get_line ();
157+ if (!line.empty ())
158+ {
159+ block.lines .insert (unsafe_string2unsigned (id2string (line)));
160+ block.source_lines .insert (instruction.source_location );
161+ }
162+ }
163+
158164void cover_basic_blockst::update_covered_lines (block_infot &block_info)
159165{
160166 if (block_info.source_location .is_nil ())
Original file line number Diff line number Diff line change @@ -119,6 +119,11 @@ class cover_basic_blockst final : public cover_blocks_baset
119119 // / map block numbers to block information
120120 std::vector<block_infot> block_infos;
121121
122+ // / Adds the lines which \param instruction spans to \param block.
123+ static void add_block_lines (
124+ cover_basic_blockst::block_infot &block,
125+ const goto_programt::instructiont &instruction);
126+
122127 // / create list of covered lines as CSV string and set as property of source
123128 // / location of basic block, compress to ranges if applicable
124129 static void update_covered_lines (block_infot &block_info);
You can’t perform that action at this time.
0 commit comments