llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

line coverage doesn't show coverage of line after #endif

Open ZequanWu opened this issue 6 years ago • 1 comments

Bugzilla Link 46660
Resolution FIXED
Resolved on Jul 10, 2020 11:46
Version trunk
OS Linux
CC @dwblaikie,@zygoloid

Extended Description

$ cat /tmp/a.c int main() { int i = 0; #ifdef MACRO int x = i; #endif return i; }

$ clang -fcoverage-mapping -fprofile-instr-generate /tmp/a.c -Xclang -dump-coverage-mapping && ./a.out && llvm-profdata merge -sparse default.profraw -o a.profdata && llvm-cov show ./a.out -instr-profile=a.profdata main: File 0, 1:12 -> 7:2 = #​0 Skipped,File 0, 3:1 -> 6:1 = 0 1| 1|int main() { 2| 1| int i = 0; 3| |#ifdef MACRO 4| | int x = i; 5| |#endif 6| | return i; 7| 1|}

line 6 is shown as not tracked.

ZequanWu avatar Jul 09 '20 17:07 ZequanWu

Fixed at https://reviews.llvm.org/rGdcd76c0c0716a4417110423718c7cae4b516b4d0

ZequanWu avatar Jul 10 '20 18:07 ZequanWu