[cfe-dev] probable bug in clang source based coverage
Michał Pszona via cfe-dev
cfe-dev at lists.llvm.org
Thu Mar 23 08:35:03 PDT 2017
Vedant,
First of all, thank you so much for your help!
It took me some time to wrap my mind around this and actually
realized, that the information in the segments array is more verbose
than I was expecting :)
I was assuming this something similar to what regions array in the
function entry is.
>
> The `IsRegionEntry` field is just used as a hint by llvm-cov to compute better line execution counts, and to determine when it is appropriate to create tooltips for regions within a line.
>
This might be confusing as my tool can't figure out which region
should the counters be inherited from.
>
> If you choose to think of segments as 'closing' a region, consider that one may 'close' multiple regions.
>
Again, I can't be sure which segments are being closed and which
should still be open.
>
> What kind of source annotations are you interested in? If it's similar to something llvm-cov does, I can provide more details about how it works.
>
Yes, it is basically the same job as SourceCoverageViewHTML class
does, but it operates on the exported json data.
The tool I'm developing is aggregating the data from llvm-cov's export
command from different executables and runs.
Thus getting summary of all the files used in several binaries, but on
one codebase.
Maybe there is a better way to do this or you know any existing tool
that can do it for me ?
As far as I was able to figure out, it would be a bit problematic to
add it to llvm-cov because of the way the coverage data is defined.
So the way I understand it so far is as follows:
The positions in the segments array are actually markers for the code
"colorization" (based on hit count)
Wherever a new marker is set, it is valid for the rest of the line and
all the lines until a new marker is set.
The code can be marked as (based only on the current marker):
- covered when the hasCount field is set and Count is greater than 0.
- uncovered when hasCount field is set but count is 0
- skipped/uninstrumented otherwise (hasCount should be 0)
As far as I can see, the IsRegionCount field is only used to determine
if you need to colorize multiple regions in one line and produce a
tooltip.
Can you confirm this is correct?
regards,
Michał Pszona
More information about the cfe-dev
mailing list