On 11/07/2017 05:53 AM, Martin Liška wrote:
Hello.
This is slightly updated version from the previous. Various small issues were
fixed
and I update documentation in order to reflect the changes.
+ gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl));
gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
+ gcov_write_unsigned (expand_location (cfun->function_end_locus).line);
gcov_write_length (offset);
this is presuming the end line is in the same file as the start line. A
reasonable assumption, but users can have exciting ideas! What is the
failure mode if the function straddles a file boundary?
+ /* True when multiple functions start at a line in a source file. */
+ unsigned is_group : 1;
Is this true for the non-template instantiation case of:
void a () {} void b () {}
What happens there? (perhaps we cannot tell the difference?)
+ inline bool operator() (const function_info *lhs,
+ const function_info *rhs)
+ {
+ return lhs->end_line < rhs->start_line;
+ }
This isn't stable if they start on the same line. Will output order
depend on the vaguaries of the sorting algorithm?
+ vector<line_info> &lines = (*it2)->lines;
+ /* Print all lines covered by the function. */
+ for (unsigned i = 0; i < lines.size (); i++)
comment seems to apply to the whole block, not just the for loop? The
lines init is merely local cache? (this stood out because of lack of
blank line before the comment, btw)
Otherwise looks good, and a nice improvement. Please investigate the
corner cases mentioned above though.
nathan
--
Nathan Sidwell