I am building a library with a few *.c files and have a test file in subfolder test. The build tools are CMake, CLang and ninja. It runs on Windows 10 and on Unbuntu 16.04. I am trying to generate code coverage for viewing.
On Unbuntu my CMakeLists.txt include the line
set(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping -pthread")
I am not sure what these options do.
The compiler generates test.cpp.o and test.cpp.gcno. Running the test program generates test.cpp.gcda.
Running llvm-cov with these files causes
llvm-cov show: for the -instr-profile option: must be specified at least once!
I have also seen errors like
llvm-cov gcov: Not enough positional command line arguments specified!
I see
USAGE: llvm-cov gcov [options] SOURCEFILE but have never seen an explanation or an example of what a SOURCEFILE is.
I am interested in seeing which lines of code are used at least once. What am I missing?