[PATCH] D18787: [Coverage] Prevent false instantiations detection in case of macro expansions.
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 03:35:47 PDT 2016
ikudrin added a comment.
Use the following commands to reproduce the issue:
$ cat > sample.cpp << EOF
#include "sample.h"
void func1() {
DO_SOMETHING();
}
void func2() {
DO_SOMETHING();
}
int main() {
for (int I = 0; I < 10; ++I)
if (I < 7)
func1();
else
func2();
return 0;
}
EOF
$ cat > sample.h << EOF
#define DO_SOMETHING() \
do { \
} while(0)
/*
* We need some lines here to show the issue.
*
*
*
*/
EOF
$ clang++ -fprofile-instr-generate -fcoverage-mapping sample.cpp
$ ./a.out
$ llvm-profdata merge -o default.profdata default.profraw
$ llvm-cov show a.out -instr-profile default.profdata -filename-equivalence sample.h
| 1|#define DO_SOMETHING() \
10| 2| do { \
10| 3| } while(0)
| 4|
| 5|/*
------------------
| _Z5func1v:
| 7| 3| } while(0)
| 7| 4|
| 7| 5|/*
------------------
| 6| * We need some lines here to show the issue.
| 7| *
| 8| *
| 9| *
------------------
| _Z5func2v:
| 3| 7| *
| 3| 8| *
| 3| 9| *
------------------
| 10| */
http://reviews.llvm.org/D18787
More information about the llvm-commits
mailing list