lcov-to-cobertura-xml icon indicating copy to clipboard operation
lcov-to-cobertura-xml copied to clipboard

Fix duplicate C++ ctor/dtor entries with --demangle.

Open calin-iorgulescu opened this issue 1 year ago • 1 comments

Under certain circumstances, gcc seems to emit multiple symbols for ctors and dtors. This seems to be in adherence with the specification of the Itanium C++ ABI. A pretty good description of the issue can be found here .

However, c++filt generates the same demangled names for these symbols. Apparently, this was not always the case. Since demangling is currently done after reading the lcov files, this results in duplicate entries in the output XML file.

According to the Cobertura DTD, each class should only have a single method entry. This can lead to issues with certain parsers. For example, the Jenkins Coverage plugin will not accept XML files with duplicate method entries for the same class.

This PR resolves the issue by applying the demangling operation when the function hit data is stored, and summing the hit counts as needed.

calin-iorgulescu avatar Nov 08 '23 23:11 calin-iorgulescu