summaryrefslogtreecommitdiff
path: root/tools/llvm-cov
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-11-09 02:33:43 +0000
committerVedant Kumar <vsk@apple.com>2017-11-09 02:33:43 +0000
commitf361756cf35f7567d56bb12621b99599a8c539e9 (patch)
treed8007efb9c8139bce06a81fa4b77ec6ee9146a1c /tools/llvm-cov
parent9960086c1116025fa44f27d30fa6b20f53fc5373 (diff)
[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
Diffstat (limited to 'tools/llvm-cov')
-rw-r--r--tools/llvm-cov/SourceCoverageViewHTML.cpp12
-rw-r--r--tools/llvm-cov/SourceCoverageViewText.cpp11
2 files changed, 12 insertions, 11 deletions
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<std::pair<unsigned, unsigned>, 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;
}