[llvm] r316107 - [llvm-cov] Highlight gaps in consecutive uncovered regions
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 11:52:27 PDT 2017
Author: vedantk
Date: Wed Oct 18 11:52:27 2017
New Revision: 316107
URL: http://llvm.org/viewvc/llvm-project?rev=316107&view=rev
Log:
[llvm-cov] Highlight gaps in consecutive uncovered regions
llvm-cov typically doesn't highlight gap segments, but it should if the
gap occurs after an uncovered region in order to preserve continuity.
Modified:
llvm/trunk/test/tools/llvm-cov/deferred-region.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=316107&r1=316106&r2=316107&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:27 2017
@@ -116,6 +116,7 @@ int main() {
// 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/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=316107&r1=316106&r2=316107&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Wed Oct 18 11:52:27 2017
@@ -506,7 +506,7 @@ void SourceCoverageViewHTML::renderLine(
// 1 to set the highlight for snippet 2, segment 2 to set the highlight for
// snippet 3, and so on.
- Optional<std::string> Color;
+ Optional<StringRef> Color;
SmallVector<std::pair<unsigned, unsigned>, 2> HighlightedRanges;
auto Highlight = [&](const std::string &Snippet, unsigned LC, unsigned RC) {
if (getOptions().Debug)
@@ -528,7 +528,8 @@ void SourceCoverageViewHTML::renderLine(
const auto *CurSeg = Segments[I];
if (CurSeg->Col == ExpansionCol)
Color = "cyan";
- else if (!CurSeg->IsGapRegion && CheckIfUncovered(CurSeg))
+ else if ((!CurSeg->IsGapRegion || (Color && *Color == "red")) &&
+ CheckIfUncovered(CurSeg))
Color = "red";
else
Color = None;
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp?rev=316107&r1=316106&r2=316107&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp Wed Oct 18 11:52:27 2017
@@ -121,7 +121,8 @@ void SourceCoverageViewText::renderLine(
Col = End;
if (Col == ExpansionCol)
Highlight = raw_ostream::CYAN;
- else if (!S->IsGapRegion && S->HasCount && S->Count == 0)
+ else if ((!S->IsGapRegion || Highlight == raw_ostream::RED) &&
+ S->HasCount && S->Count == 0)
Highlight = raw_ostream::RED;
else
Highlight = None;
More information about the llvm-commits
mailing list