ikudrin added a comment. The motivation sample:
$ cat > test.cpp << EOF void dummy() {} #define MACRO dummy() int main() { int i = 0; while (i++ < 10) if (i < 5) MACRO; return 0; } EOF $ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp test.cpp $ ./a.out $ llvm-profdata merge -o default.profdata default.profraw $ llvm-cov show a.out -instr-profile --show-expansions default.profdata test.cpp: 4| 1|void dummy() {} | 2| 14| 3|#define MACRO dummy() | 4| | 5|int main() 1| 6|{ 1| 7| int i = 0; 11| 8| while (i++ < 10) 10| 9| if (i < 5) 4| 10| MACRO; ------------------ | | 14| 3|#define MACRO dummy() ------------------ 1| 11| return 0; 1| 12|} After applying this patch the counter for MACRO shows a reasonable value: $ llvm-cov show a.out -instr-profile --show-expansions default.profdata test.cpp: 4| 1|void dummy() {} | 2| 4| 3|#define MACRO dummy() | 4| | 5|int main() 1| 6|{ 1| 7| int i = 0; 11| 8| while (i++ < 10) 10| 9| if (i < 5) 4| 10| MACRO; ------------------ | | 4| 3|#define MACRO dummy() ------------------ 1| 11| return 0; 1| 12|} https://reviews.llvm.org/D23160 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits