[llvm-dev] How to get branch coverage by using 'source-based code coverage'

LoveZhi Xie via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 26 09:35:33 PDT 2020


Hi, llvm/clang experts

I need to get the branch coverage for some testing code. But i found gcov
can't give a expected coverage which may
count some 'hidden branch' in (See stackoverflow answer
<https://stackoverflow.com/questions/42003783/lcov-gcov-branch-coverage-with-c-producing-branches-all-over-the-place>).
Instead, I turn to use clang and the 'source-based code coverage' feature
may be a right choice. But i can't find anything to describe branch
coverage explicitly on the official site
<https://clang.llvm.org/docs/SourceBasedCodeCoverage.html>.

So how to use clang to get branch coverage by utilizing 'source-based...'
feature?  And is *region coverage *equivalent to branch coverage?
(I tested on a simple program and region coverage seems pretty close to
branch coverage)

Any help is highly appreciated

Thanks,
Ted Xie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200427/d9aad1e1/attachment-0001.html>


More information about the llvm-dev mailing list