[llvm] r316109 - [llvm-cov] Suppress sub-line highlights in simple cases
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 11:52:29 PDT 2017
Author: vedantk
Date: Wed Oct 18 11:52:29 2017
New Revision: 316109
URL: http://llvm.org/viewvc/llvm-project?rev=316109&view=rev
Log:
[llvm-cov] Suppress sub-line highlights in simple cases
llvm-cov tends to highlight too many regions because its policy is to
highlight all region entry segments. This can look confusing to users:
not all region entry segments are interesting and deserve highlighting.
Emitting these highlights only when the region count differs from the
line count is a more user-friendly policy.
Modified:
llvm/trunk/test/tools/llvm-cov/deferred-region.cpp
llvm/trunk/test/tools/llvm-cov/showRegionMarkers.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
Modified: llvm/trunk/test/tools/llvm-cov/deferred-region.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/deferred-region.cpp?rev=316109&r1=316108&r2=316109&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/deferred-region.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/deferred-region.cpp Wed Oct 18 11:52:29 2017
@@ -88,35 +88,23 @@ int main() {
return 0;
}
-// MARKER: Marker at 4:7 = 2
-// MARKER-NEXT: Highlighted line 17, 5 -> 11
+// MARKER: Highlighted line 17, 5 -> 11
// MARKER-NEXT: Marker at 19:3 = 1
-// MARKER-NEXT: Marker at 19:19 = 2
// MARKER-NEXT: Marker at 19:27 = 1
-// MARKER-NEXT: Marker at 23:5 = 1
-// MARKER-NEXT: Marker at 23:9 = 1
// MARKER-NEXT: Highlighted line 24, 7 -> 12
// MARKER-NEXT: Highlighted line 36, 5 -> 11
-// MARKER-NEXT: Marker at 39:10 = 3
-// MARKER-NEXT: Marker at 43:5 = 1
-// MARKER-NEXT: Marker at 43:12 = 1
// MARKER-NEXT: Highlighted line 46, 1 -> ?
// MARKER-NEXT: Highlighted line 47, 1 -> 7
// MARKER-NEXT: Highlighted line 47, 7 -> 14
// MARKER-NEXT: Highlighted line 47, 14 -> 21
// MARKER-NEXT: Highlighted line 47, 21 -> 23
// MARKER-NEXT: Highlighted line 47, 23 -> 25
-// MARKER-NEXT: Marker at 47:7 = 0
-// MARKER-NEXT: Marker at 47:14 = 0
-// MARKER-NEXT: Marker at 47:23 = 0
// MARKER-NEXT: Highlighted line 51, 7 -> 20
// MARKER-NEXT: Marker at 53:5 = 1
-// MARKER-NEXT: Marker at 53:12 = 6
// MARKER-NEXT: Highlighted line 55, 9 -> 14
// MARKER-NEXT: Highlighted line 63, 5 -> 13
// MARKER-NEXT: Highlighted line 67, 1 -> ?
// MARKER-NEXT: Highlighted line 68, 1 -> 8
// MARKER-NEXT: Highlighted line 68, 8 -> ?
// MARKER-NEXT: Highlighted line 69, 1 -> 2
-// MARKER-NEXT: Marker at 72:7 = 2
// MARKER-NEXT: Highlighted line 77, 1 -> 2
Modified: llvm/trunk/test/tools/llvm-cov/showRegionMarkers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showRegionMarkers.cpp?rev=316109&r1=316108&r2=316109&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showRegionMarkers.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showRegionMarkers.cpp Wed Oct 18 11:52:29 2017
@@ -8,12 +8,12 @@ int main() { // CHE
} else { // CHECK-NOT: Marker at [[@LINE]]:10
x = 1;
}
- // CHECK: Marker at [[@LINE+2]]:19 = 112M
+ // CHECK-NOT: Marker at [[@LINE+2]]:19
// CHECK: Marker at [[@LINE+1]]:28 = 111M
for (int i = 0; i < 100; ++i) { // CHECK-NOT: Marker at [[@LINE]]:33
x = 1;
}
- // CHECK: Marker at [[@LINE+1]]:16 = 1.11M
+ // CHECK-NOT: Marker at [[@LINE+1]]:16
x = x < 10 ? x + 1 : x - 1; // CHECK: Marker at [[@LINE]]:24 = 0
x = x > 10 ?
x - 1: // CHECK-NOT: Marker at [[@LINE]]:9
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=316109&r1=316108&r2=316109&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Wed Oct 18 11:52:29 2017
@@ -563,6 +563,8 @@ void SourceCoverageViewHTML::renderLine(
const auto *CurSeg = Segments[I];
if (!CurSeg->IsRegionEntry)
continue;
+ if (CurSeg->Count == LCS.getExecutionCount())
+ continue;
Snippets[I + 1] =
tag("div", Snippets[I + 1] + tag("span", formatCount(CurSeg->Count),
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp?rev=316109&r1=316108&r2=316109&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp Wed Oct 18 11:52:29 2017
@@ -186,6 +186,8 @@ void SourceCoverageViewText::renderRegio
for (const auto *S : Segments) {
if (!S->IsRegionEntry)
continue;
+ if (S->Count == Line.getExecutionCount())
+ continue;
// Skip to the new region.
if (S->Col > PrevColumn)
OS.indent(S->Col - PrevColumn);
More information about the llvm-commits
mailing list