When compiling for target x86_64-pc-windows-msvc, a lot of member functions are not taken into account for coverage instrumentation. I could reproduce the occurence with the following minimal example:
struct Test
{
void testfunction();
};
struct A
{
~A(){};
};
struct B
{
B(){};
};
void Test::testfunction()
{
A a;
B b;
}
Steps for compiling / looking at coverage metadata:
As can be seen, the member function testfunction() is considered as non executable code.
In the following cases, however, the function is considered as executable:
Swap lines 18 and 19, so B is constructed before A
Remove destructor from class A
Remove constructor from class B
Set option --target=x86_64-linux-gnu when compiling on Windows
Do not set option --target=x86_64-pc-windows when compiling on Linux
Behaviour was seen on:
Ubuntu clang version 14.0.0-1ubuntu1
clang version 13.0.0 shipped by Visual Studio 17.1.0
When compiling for target
x86_64-pc-windows-msvc
, a lot of member functions are not taken into account for coverage instrumentation. I could reproduce the occurence with the following minimal example:Steps for compiling / looking at coverage metadata:
As can be seen, the member function
testfunction()
is considered as non executable code. In the following cases, however, the function is considered as executable:B
is constructed beforeA
A
B
--target=x86_64-linux-gnu
when compiling on Windows--target=x86_64-pc-windows
when compiling on LinuxBehaviour was seen on:
Ubuntu clang version 14.0.0-1ubuntu1
clang version 13.0.0
shipped by Visual Studio 17.1.0clang version 15.0.6
downloaded from GitHub