From f361756cf35f7567d56bb12621b99599a8c539e9 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 9 Nov 2017 02:33:43 +0000 Subject: [Coverage] Use the wrapped segment when a line has entry segments We've worked around bugs in the frontend by ignoring the count from wrapped segments when a line has at least one region entry segment. Those frontend bugs are now fixed, so it's time to regenerate the checked-in covmapping files and remove the workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317761 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-cov/SourceCoverageViewHTML.cpp | 12 ++++++------ tools/llvm-cov/SourceCoverageViewText.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'tools/llvm-cov') diff --git a/tools/llvm-cov/SourceCoverageViewHTML.cpp b/tools/llvm-cov/SourceCoverageViewHTML.cpp index e83918474cb..7e9fc238dbe 100644 --- a/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -514,8 +514,9 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L, return tag("span", Snippet, Color.getValue()); }; - auto CheckIfUncovered = [](const CoverageSegment *S) { - return S && S->HasCount && S->Count == 0; + auto CheckIfUncovered = [&](const CoverageSegment *S) { + return S && (!S->IsGapRegion || (Color && *Color == "red")) && + S->HasCount && S->Count == 0; }; if (CheckIfUncovered(LCS.getWrappedSegment())) { @@ -526,11 +527,10 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L, for (unsigned I = 0, E = Segments.size(); I < E; ++I) { const auto *CurSeg = Segments[I]; - if (CurSeg->Col == ExpansionCol) - Color = "cyan"; - else if ((!CurSeg->IsGapRegion || (Color && *Color == "red")) && - CheckIfUncovered(CurSeg)) + if (CheckIfUncovered(CurSeg)) Color = "red"; + else if (CurSeg->Col == ExpansionCol) + Color = "cyan"; else Color = None; diff --git a/tools/llvm-cov/SourceCoverageViewText.cpp b/tools/llvm-cov/SourceCoverageViewText.cpp index 4b69b08e5a5..2480ee9f416 100644 --- a/tools/llvm-cov/SourceCoverageViewText.cpp +++ b/tools/llvm-cov/SourceCoverageViewText.cpp @@ -106,7 +106,8 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L, SmallVector, 2> HighlightedRanges; // The first segment overlaps from a previous line, so we treat it specially. - if (WrappedSegment && WrappedSegment->HasCount && WrappedSegment->Count == 0) + if (WrappedSegment && !WrappedSegment->IsGapRegion && + WrappedSegment->HasCount && WrappedSegment->Count == 0) Highlight = raw_ostream::RED; // Output each segment of the line, possibly highlighted. @@ -120,11 +121,11 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L, if (getOptions().Debug && Highlight) HighlightedRanges.push_back(std::make_pair(Col, End)); Col = End; - if (Col == ExpansionCol) - Highlight = raw_ostream::CYAN; - else if ((!S->IsGapRegion || Highlight == raw_ostream::RED) && - S->HasCount && S->Count == 0) + if ((!S->IsGapRegion || (Highlight && *Highlight == raw_ostream::RED)) && + S->HasCount && S->Count == 0) Highlight = raw_ostream::RED; + else if (Col == ExpansionCol) + Highlight = raw_ostream::CYAN; else Highlight = None; } -- cgit v1.2.3