mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-27 21:50:29 +00:00
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316109 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d35bb38d3b
commit
4a5c81f50f
@ -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
|
||||
|
@ -8,12 +8,12 @@ int main() { // CHECK-NOT: Marker at [[@LINE]]:12
|
||||
} 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
|
||||
|
@ -563,6 +563,8 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
|
||||
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),
|
||||
|
@ -186,6 +186,8 @@ void SourceCoverageViewText::renderRegionMarkers(raw_ostream &OS,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user