llvm-project/llvm/test/tools/llvm-cov
Igor Kudrin 1c99f650a7 [llvm-cov gcov] Fix calculating coverage of template functions
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
...

Differential Revision: https://reviews.llvm.org/D121390
2022-03-15 20:46:22 +04:00
..
Inputs
gcov [llvm-cov gcov] Fix calculating coverage of template functions 2022-03-15 20:46:22 +04:00
binary-formats.c
branch-c-general.test
branch-export-json.test
branch-export-lcov.test
branch-logical-mixed.cpp
branch-macros.cpp
branch-noShowBranch.test
branch-showBranchPercentage.c
branch-templates.cpp
combine_expansions.cpp
comma-in-coverage-object-filename.test
compilation_dir.c
cov-comdat.test
coverage-prefix-map.test
deferred-region.cpp
demangle.test
dir-with-filtering.test
double_dots.c
export_functions-lcov.test
export_functions.test
hideUnexecutedSubviews.test
ifdef.c
ignore-filename-regex.test
lit.local.cfg
load-multiple-objects.test
misssing-profdata.test
multiple-files.test
multiple-objects-not-all-instrumented.test
multiple-objects.test
multithreaded-report.test
name_allowlist.test
name_whitelist.test
native_separators.c
path_equivalence.c
prefer_used_to_unused.h
prevent_false_instantiations.h
report.cpp
scan-directory.test
showExpansions.cpp
showHighlightedRanges.cpp
showLineExecutionCounts-lcov.test
showLineExecutionCounts.cpp
showProjectSummary.cpp
showRegionMarkers.cpp
showTabsHTML.cpp
showTemplateInstantiations.cpp
sources-specified.test
style.test
threads.c
tool-name.test
universal-binary.c
universal_bin_wrapping_archives.test
warnings.h
zeroFunctionFile.c