[PATCH] D20287: [Coverage] Ensure that the hash for a used function is non-zero.
Igor Kudrin via cfe-commits
cfe-commits at lists.llvm.org
Mon May 16 09:16:59 PDT 2016
ikudrin added a comment.
The motivation sample (using llvm-cov with http://reviews.llvm.org/D20286 applied):
$ cat > sample.h << EOF
inline int sample_func(int A) {
return A;
}
EOF
$ cat > dummy.cpp << EOF
#include "sample.h"
EOF
$ cat > sample.cpp << EOF
#include "sample.h"
int main() {
return sample_func(5);
}
EOF
$ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp sample.cpp
$ ./a.out
$ llvm-profdata merge -o default.profdata default.profraw
$ llvm-cov show a.out -instr-profile default.profdata
sample.h:
0| 1|inline int sample_func(int A) {
0| 2| return A;
0| 3|}
sample.cpp:
| 1|#include "sample.h"
| 2|
1| 3|int main() {
1| 4| return sample_func(5);
1| 5|}
And if this patch is applied:
$ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp sample.cpp
$ ./a.out
$ llvm-profdata merge -o default.profdata default.profraw
$ llvm-cov show a.out -instr-profile default.profdata
sample.h:
1| 1|inline int sample_func(int A) {
1| 2| return A;
1| 3|}
sample.cpp:
| 1|#include "sample.h"
| 2|
1| 3|int main() {
1| 4| return sample_func(5);
1| 5|}
http://reviews.llvm.org/D20287
More information about the cfe-commits
mailing list