Create zero-coverage baseline for all files with llvm-cov

510 views Asked by At

I am trying to make a coverage report using clang's llvm-cov on Mac. I'd like all instrumented files (ie all files in my build) -- not just files touched by my unit test -- to be included in the coverage report. Any files not touched at all by the tests should be marked 0%.

I've used lcov on Linux to do this in the past. You start with a 0% baseline coverage by running run lcov --capture --initial -- this creates coverage data file that contains zero coverage for every instrumented line of the project, as explained here. You then merge this baseline with a coverage report generated while running your tests. Unfortunately, I cannot find an equivalent to this command for llvm-cov.

Does anyone know if providing a 0% baseline coverage for a whole project is possible with clang?

1

There are 1 answers

0
huahua On
  • You can specify the path to the symbol library
llvm-cov report xxx.so -instr-profile=xx.profdata