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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to