[all-commits] [llvm/llvm-project] 1c99f6: [llvm-cov gcov] Fix calculating coverage of templa...
Igor Kudrin via All-commits
all-commits at lists.llvm.org
Tue Mar 15 09:48:25 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1c99f650a7ac90c80ffd4830e05cd3408e64f42c
https://github.com/llvm/llvm-project/commit/1c99f650a7ac90c80ffd4830e05cd3408e64f42c
Author: Igor Kudrin <ikudrin at accesssoftek.com>
Date: 2022-03-15 (Tue, 15 Mar 2022)
Changed paths:
M llvm/lib/ProfileData/GCOV.cpp
A llvm/test/tools/llvm-cov/gcov/Inputs/tmpl.cpp
A llvm/test/tools/llvm-cov/gcov/Inputs/tmpl.gcda
A llvm/test/tools/llvm-cov/gcov/Inputs/tmpl.gcno
A llvm/test/tools/llvm-cov/gcov/tmpl.test
Log Message:
-----------
[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
More information about the All-commits
mailing list