Template functions share the same lines in source files, so the common container of lines' properties cannot be used to calculate the coverage statistics of individual functions.
> cat tmpl.cpp template <int N> int test() { return N; } int main() { return test<1>() + test<2>(); } > clang++ --coverage tmpl.cpp -o tmpl > ./tmpl > llvm-cov gcov tmpl.cpp -f ... Function '_Z4testILi1EEiv' Lines executed:100.00% of 1 Function '_Z4testILi2EEiv' Lines executed:-nan% of 0 ... > llvm-cov-patched gcov tmpl.cpp -f ... Function '_Z4testILi1EEiv' Lines executed:100.00% of 1 Function '_Z4testILi2EEiv' Lines executed:100.00% of 1 ...
Optional: llvm:: is usually omitted for llvm/lib files.