https://bugs.llvm.org/show_bug.cgi?id=45757
Bug ID: 45757
Summary: line coverage shows coverage of comments
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: h...@chromium.org
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk,
v...@apple.com
For example:
$ cat /tmp/a.c
int f(int x) {
if (x == 42) {
// Comment 1.
return 1;
}
// Comment 2.
return 0;
}
int main() {
f(1);
return 0;
}
$ bin/clang -fcoverage-mapping -fprofile-instr-generate /tmp/a.c
$ ./a.out
$ bin/llvm-profdata merge default.profraw -o default.profdata
$ bin/llvm-cov show a.out -instr-profile=default.profdata
1| 1|int f(int x) {
2| 1| if (x == 42) {
3| 0| // Comment 1.
4| 0| return 1;
5| 0| }
6| 1| // Comment 2.
7| 1| return 0;
8| 1|}
9| |
10| 1|int main() {
11| 1| f(1);
12| 1| return 0;
13| 1|}
Comment 1 gets an execution count of 0 (and shows on red background in the
console) but Comment 2 is marked executed.
Does it make sense to have counters for comments, since they can't really be
executed?
(This was reported by Chromium's code coverage folks in
https://bugs.chromium.org/p/chromium/issues/detail?id=1074518)
It seems gcc/gcov doesn't count the comment lines (gcc -fprofile-arcs
-ftest-coverage /tmp/a.c && ./a.out && gcov a.c && cat a.c.gcov).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs