diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-09-19 08:13:16 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-09-19 08:13:16 +0000 |
| commit | 13ba23bb79ce689f29d67e8656a599f019e9bb03 (patch) | |
| tree | 5c72fca53e1d8c071611a095fc27360ba1c5afbf /llvm | |
| parent | 116c16642d38ca5c09a6eddbbd4d71f0a9d746e7 (diff) | |
| download | bcm5719-llvm-13ba23bb79ce689f29d67e8656a599f019e9bb03.tar.gz bcm5719-llvm-13ba23bb79ce689f29d67e8656a599f019e9bb03.zip | |
llvm-cov: Fix dropped lines when filters were applied
Uncovered lines in the middle of a covered region weren't being shown
when filtering to a particular function.
llvm-svn: 218109
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping | bin | 194 -> 162 bytes | |||
| -rw-r--r-- | llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp | 7 | ||||
| -rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping Binary files differindex 5cfa1694da2..9774b89ede8 100644 --- a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping +++ b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp index 9c94344e5ee..34baa574dab 100644 --- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp +++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp @@ -1,5 +1,8 @@ -// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %S/Inputs/lineExecutionCounts.profdata -no-colors -filename-equivalence %s | FileCheck %s +// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %S/Inputs/lineExecutionCounts.profdata -no-colors -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=WHOLE-FILE %s +// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %S/Inputs/lineExecutionCounts.profdata -no-colors -filename-equivalence -name=main %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s +// before any coverage // WHOLE-FILE: | [[@LINE]]|// before + // FILTER-NOT: | [[@LINE-1]]|// before int main() { // CHECK: 1| [[@LINE]]|int main( int x = 0; // CHECK: 1| [[@LINE]]| int x // CHECK: 1| [[@LINE]]| @@ -20,6 +23,8 @@ int main() { // CHECK: 1| [[@LINE]]|int main( // CHECK: 1| [[@LINE]]| return 0; // CHECK: 1| [[@LINE]]| return } // CHECK: 1| [[@LINE]]|} +// after coverage // WHOLE-FILE: | [[@LINE]]|// after + // FILTER-NOT: | [[@LINE-1]]|// after // llvm-cov doesn't work on big endian yet // XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 2ad3e145198..3be54f828da 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -163,6 +163,7 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile, auto NextSegment = CoverageSegments.begin(); auto EndSegment = CoverageSegments.end(); + unsigned FirstLine = NextSegment != EndSegment ? NextSegment->Line : 0; const CoverageSegment *WrappedSegment = nullptr; SmallVector<const CoverageSegment *, 8> LineSegments; for (line_iterator LI(File, /*SkipBlanks=*/false); !LI.is_at_eof(); ++LI) { @@ -171,7 +172,7 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile, if (!WholeFile) { if (NextSegment == EndSegment) break; - else if (LI.line_number() < NextSegment->Line) + else if (LI.line_number() < FirstLine) continue; } |

