[PATCH] D121390: [llvm-cov gcov] Fix calculating coverage of template functions
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 00:27:38 PST 2022
MaskRay added a comment.
`curl -L 'https://reviews.llvm.org/D121390?download=1'` does not include the contents for tmpl.gcno and tmpl.gcda.
So I just run:
clang++ --coverage tmpl.cpp -o tmpl
./tmpl
llvm-cov gcov tmpl.cpp -t
I do not see a difference with and w/o the patch.
> Template functions share the same lines in source files, so the common container of lines' properties cannot be used to calculate the coverage of individual functions.
Suppose there is indeed a difference. It's useful to attach a C++ program and line execution counts before and after this patch, for the relevant lines.
================
Comment at: llvm/test/tools/llvm-cov/gcov/tmpl.cpp:1
+// RUN: llvm-cov gcov %p/Inputs/tmpl.gcda --gcno=%p/Inputs/tmpl.gcno -f | FileCheck %s
+
----------------
`llvm-cov gcov %s --gcno=%p/Inputs/tmpl.gcno --gcda=%p/Inputs/tmpl.gcda`
================
Comment at: llvm/test/tools/llvm-cov/gcov/tmpl.cpp:14
+int main() {
+ return test<1>(1) +
+ test<1>(2) +
----------------
It's useful to dump `llvm-cov gcov -t` and test the line counts for the three lines, to better leverage this test file.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121390/new/
https://reviews.llvm.org/D121390
More information about the llvm-commits
mailing list