diff options
author | Vedant Kumar <vsk@apple.com> | 2017-10-18 18:52:29 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-10-18 18:52:29 +0000 |
commit | 9cbd33fec9d7a15cc2ef9f9fd82491baa41eb552 (patch) | |
tree | 2cc71eaac68ef713cc50fb0d968d8bbb91fdfe8b /llvm/tools/llvm-cov | |
parent | 08a0a3100389dc850729673e6591a539693c1fe0 (diff) | |
download | llvm-9cbd33fec9d7a15cc2ef9f9fd82491baa41eb552.zip llvm-9cbd33fec9d7a15cc2ef9f9fd82491baa41eb552.tar.gz llvm-9cbd33fec9d7a15cc2ef9f9fd82491baa41eb552.tar.bz2 |
[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.
llvm-svn: 316109
Diffstat (limited to 'llvm/tools/llvm-cov')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewText.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index 626016f..4900ad4 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -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), diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp index 83d228e..2ed16df 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp @@ -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); |