[llvm] [llvm-cov] Fix branch counts of template functions (second attempt) (PR #135074)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 07:55:14 PDT 2025


stma247 wrote:

The key is to add an additional field "NestedCountedRegion::Position" which is used by function "sortNested" when ambiguous entries are contained in collections such as "Branches". Such entries may appear whenever a template function with more than one instantiation occurs (then all fields of NestedCountedRegion and it's base classes contain equal values). The field "Position" makes every entry unique and the shuffle of "llvm::sort" has no bad impact on the result.

This problem existed even without my changes, but the new test "branch-export-lcov-unify-instances.test" brought it to light as it does more pedantic checks than the existing template tests.

https://github.com/llvm/llvm-project/pull/135074


More information about the llvm-commits mailing list