diff options
author | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-06-07 10:07:51 +0000 |
---|---|---|
committer | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-06-07 10:07:51 +0000 |
commit | d9e1a61d3149ef54d6ce84e0268ae63f32bba181 (patch) | |
tree | 83ce528d30815b80ff0c6c4ea89ce94804163c69 /clang/test/CoverageMapping/unused_function.cpp | |
parent | 5dd3c292bc495b9576f9ea1a8eba2addf613d598 (diff) | |
download | llvm-d9e1a61d3149ef54d6ce84e0268ae63f32bba181.zip llvm-d9e1a61d3149ef54d6ce84e0268ae63f32bba181.tar.gz llvm-d9e1a61d3149ef54d6ce84e0268ae63f32bba181.tar.bz2 |
Reapply [Coverage] Fix an assertion failure if the definition of an unused function spans multiple files.
We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.
Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows.
Differential Revision: http://reviews.llvm.org/D20997
llvm-svn: 271995
Diffstat (limited to 'clang/test/CoverageMapping/unused_function.cpp')
-rw-r--r-- | clang/test/CoverageMapping/unused_function.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/CoverageMapping/unused_function.cpp b/clang/test/CoverageMapping/unused_function.cpp new file mode 100644 index 0000000..6a46b1d --- /dev/null +++ b/clang/test/CoverageMapping/unused_function.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s + +#define START_SCOPE { +#define END_SCOPE } + +// CHECK: {{_Z2f0v|\?f0@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:20 = 0 +inline void f0() {} + +// CHECK: {{_Z2f1v|\?f1@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:31 = 0 +inline void f1() START_SCOPE } + +// CHECK: {{_Z2f2v|\?f2@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:29 = 0 +inline void f2() { END_SCOPE + +// CHECK: {{_Z2f3v|\?f3@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:39 = 0 +inline void f3() START_SCOPE END_SCOPE + +// CHECK: {{_Z2f4v|\?f4@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+2]]:10 -> [[@LINE+3]]:2 = 0 +inline void f4() +#include "Inputs/starts_a_scope_only" +} + +// CHECK: {{_Z2f5v|\?f5@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+2]]:36 = 0 +inline void f5() { +#include "Inputs/ends_a_scope_only" + +// CHECK: {{_Z2f6v|\?f6@@YAXXZ}}: +// CHECK-NEXT: File 0, [[@LINE+2]]:10 -> [[@LINE+3]]:36 = 0 +inline void f6() +#include "Inputs/starts_a_scope_only" +#include "Inputs/ends_a_scope_only" |