I'm able to export code coverage data by llvm-cov in json format, but the content seems mysterious to me. What does each number in segments section mean?
{
"filename":"file.m",
"segments":[
[
11,
22,
23,
1,
1
],
[
12,
11,
23,
1,
1
],
...
],
"expansions":[
],
"summary":{
...
}
}
Going by https://clang.llvm.org/docs/SourceBasedCodeCoverage.html, the JSON format is explained in the source code, which I found at https://github.com/llvm/llvm-project/tree/main/llvm/tools/llvm-cov.
The source code contains the following description:
Sadly this is still not very explanatory regarding what a segment is, or how it's structured.
Looking a bit more in detail at the code we find the following two snippets:
Which should give you a better idea of what the entries mean.
The file ID seems to index into the filenames given in the expansions.