[cfe-dev] Invalid coverage results from Clang's Source-based Code Coverage
Michał Pszona via cfe-dev
cfe-dev at lists.llvm.org
Fri Feb 17 03:03:12 PST 2017
I'm trying to get a reliable code coverage through Clang's
Source-based Code Coverage and am heading some false negatives on
virtual inheriting classes. In particular the inheriting class'
constructor is displayed as NOT covered.
Given this code:
#include <iostream>
class Foo
{
public:
Foo()
{
std::cout << "in Foo()" << std::endl;
}
};
class Bar : virtual public Foo
{
public:
Bar()
{
std::cout << "in Bar()" << std::endl; // supposedly not covered
};
};
int main (int argc, char* argv[])
{
Bar b;
}
The output is, obviously:
in Foo()
in Bar()
but the Bar's constructor is reported as uncovered.
I'm folliwng the steps described on the above page ie.
1. clang++ -fprofile-instr-generate -fcoverage-mapping main.cpp
2. running the binary
3. llvm-profdata merge default.profraw -o default.profdata
4. llvm-cov-4.0 show a.out --instr-profile default.profdata
Tried clang 4.0 and 5.0 (compiled from trunk) with same effect.
Could anyone help me with this issue?
Is there a way to workaround this issue?
How can I debug it to see what's causing it?
regards,
Michał Pszona
More information about the cfe-dev
mailing list