gcov reports no coverage for class declaration

Viewed 848

I have a C++ class, Foo. When I run gcov on my unit tests, it reports good coverage data for Foo's methods, but on the class declaration itself is reports nothing:

  14           0 : class DllExport Foo: public Bar {
  15             : protected:
  16             :     float field1;
  17             :     long field2;
  18             : public:
  19          21 :     virtual bool operator==(const Foo& other) const override { return field1 == other.field1 && field2 == other.field2; };

I note that this happens for a few of my classes.

I'm using lcov to generate my reports:

lcov --base-directory . --directory . -c -o foo.info
lcov --remove foo.info "/usr*" -o foo.info
rm -rf ../cov_report
genhtml -o ../cov_report -t "Foo Test Coverage" --num-spaces 4 foo.info

I know the class is being used because I can see the coverage values for the class' methods (see the operator overload above).

How can I fix this so correct coverage data are reported?

0 Answers
Related