[cfe-dev] probable bug in clang source based coverage
Vedant Kumar via cfe-dev
cfe-dev at lists.llvm.org
Mon Mar 20 11:11:46 PDT 2017
The '&&' in your example belongs to the source region corresponding to the if condition. It is always 'reached' before '(argc > 1)' is reached, so the segment contains 'argc > 1) && ('. A new segment is pushed for 'argc < 10', because it isn't always reached when the '&&' is reached.
This is why the current implementation does not emit a new segment just for the ' && ' snippet: it would be redundant.
Also, there are no 'closing' segments, only new ones. Maybe this is just a terminology mix up.
Let me know if the segments should be made more precise in any other way. If you have access to bugs.llvm.org, I'd appreciate any bug reports there (please add llvm-cov to the title).
> On Mar 20, 2017, at 5:37 AM, Michał Pszona via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> I am parsing llvm-cov exports (json files) and I was surprised by some
> of the outputs.
> I was able to narrow it to the below example:
> the source file:
> int main (int argc, char* argv)
> if ((argc > 1) && (argc < 10))
> the output:
> The confusing part is in segments section:
> "segments": [
> It looks like there is unclosed region produced.
> There are two opening marks in line 3 (cols 8 and 22) and one closing.
> I believe that there should be another closing one in col 17.
> It looks like this behavior is easily reproducible with multi
> statement conditions in if expression like this:
> if ( (a > 1) && (a < 5))
> Can someone confirm that this is a bug or if I'm not getting it right ?
> Michał Pszona
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
More information about the cfe-dev