The llvm-cov tool shows code coverage information for programs that are instrumented to emit profile data. It can be used to work with gcov-style coverage or with clang‘s instrumentation based profiling. If the program is invoked with a base name of gcov, it will behave as if the llvm-cov gcov command were called. Otherwise, a command should be provided.
Questions tagged [llvm-cov]
24 questions
11
votes
1 answer
How to generate .gcov file from llvm-cov?
I've create a project on Xcode 7 that generates code coverage data.
Inside its DerivedData folder, I can run llvm-cov show:
/usr/local/opt/llvm/bin/llvm-cov show -instr-profile Build/Intermediates/CodeCoverage/testetestes/Coverage.profdata…

Marcelo
- 9,916
- 3
- 43
- 52
9
votes
2 answers
Getting llvm-cov to talk to codecov.io
I'm in the process of (finally!) setting up code coverage monitoring for my brand new C++ project. Due to the fact that I need some advanced C++20 features (read, coroutines), I am using clang 6 as compiler.
Now, I followed this guide on how to do…

Matteo Monti
- 8,362
- 19
- 68
- 114
6
votes
2 answers
How to filter files in llvm-cov code coverage report?
From the llvm-cov docs:
llvm-cov show [options] -instr-profile PROFILE BIN [-object BIN,...] [[-object BIN]] [SOURCES]
The llvm-cov show command shows line by line coverage of the binaries
BIN,... using the profile data PROFILE. It can…

Lucien
- 8,263
- 4
- 30
- 30
5
votes
1 answer
How is llvm-cov installed on Ubuntu 18.04?
I've tried installing both clang-9, clang-9-tools, llvm-9 and llvm-9-tools in order to get the program llvm-cov. None of these packages seemingly contain llvm-cov, which leaves me to wonder what package does include it.
How do I install the latest…

Rasmus Källqvist
- 164
- 2
- 10
4
votes
1 answer
How do you use c++filt with llvm-cov report?
I'm trying to use a demangler with the llvm-cov report tool. The following is the command I'm running:
llvm-cov report /path/to/executable -instr-profile /path/to/default.profdata /path/to/src/ -Xdemangler c++filt -Xdemangler -n
I've tried…

Jyosua
- 648
- 1
- 6
- 18
3
votes
1 answer
llvm-cov: statistics for uninstantiated functions
I'm starting to work with llvm-cov to produce coverage statistics for my project. llvm-cov has several categories: line coverage, function coverage and region coverage. But they all consider only instantiated functions, functions which are not…

Jakub Klinkovský
- 1,248
- 1
- 12
- 33
2
votes
0 answers
How to collect Rust code coverage when running remote tests?
I found couple of tools that generate code coverage report (like grcov, tarpaulin, llvm-cov & kcov) for Rust code when running unit tests or when triggered by cargo.
But in our case we have remote python tests that are interacting with the remote…

Guy Korland
- 9,139
- 14
- 59
- 106
2
votes
3 answers
How to resolve unit test crash when code coverage is enabled on Xcode 11.4
We are getting a crash after excuting all unit tests when code coverage is enabled. Please find the stack trace below
Crashed Thread: 0 ReceiverMainThread Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS…

Arjuna
- 697
- 4
- 17
2
votes
0 answers
llvm-cov fails to generate report when run on cloud GitLab CI
I have been running the following llvm-cov report command (which ships as part of the Swift toolchains) in Docker images (swift:5.1) on various environments.
BINARY_PATH="..."
PROF_DATA_PATH="..."
IGNORE_FILENAME_REGEX="..."
llvm-cov report \
…

Mordil
- 108
- 1
- 7
2
votes
1 answer
LLVM coverage confused by if-constexpr
I have encountered a weird problem with LLVM coverage when using constant expressions in an if-statement:
template
int foo(const T &val)
{
int idx = 0;
if constexpr(std::is_trivially_copyable::value && sizeof(T) <=…

Resurrection
- 3,916
- 2
- 34
- 56
1
vote
0 answers
llvm-cov shows braces as uncovered
Our project migrated from gcc to clang so we changed coverage tool from gcov to llvm-cov.
It's led to many false-positives of this type:
While with gcc it worked as expected
I tried clang-12, 15, 16 and results are equal
Capturing coverage data…

tenta4
- 304
- 2
- 16
1
vote
0 answers
llvm-cov gcov: for the -b option: may only occur zero or one times
I'm trying to call llvm-cov gcov -b "$@" but getting the error: "llvm-cov gcov: for the -b option: may only occur zero or one times!" and cannot find any explanation for it... Does anybody know what it means?
context: an attempt to get code coverage…

Dmitrii
- 98
- 6
1
vote
1 answer
Create zero-coverage baseline for all files with llvm-cov
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…

Peter Moran
- 295
- 3
- 13
1
vote
1 answer
xcrun llvm-cov show: No coverage data found
What are the possible reasons for xcrun llvm-cov show command to return error: Failed to load coverage: No such file or directory?
I have an iOS lib.
The result of the lib build is *.a binary file.
I have a scheme in the project which also contains…

Oleksii Karnatskyi
- 105
- 2
- 7
1
vote
2 answers
How to read llvm-cov json format?
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,
…

Roovent
- 311
- 3
- 11