summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-10-18 18:52:28 +0000
committerVedant Kumar <vsk@apple.com>2017-10-18 18:52:28 +0000
commit08a0a3100389dc850729673e6591a539693c1fe0 (patch)
treeb9d10dcab07c0aa7b4f56937fb5160f37330b955 /llvm/tools/llvm-cov/SourceCoverageViewText.cpp
parent988faf87f8067646431dca3e238147f316d84bcb (diff)
downloadbcm5719-llvm-08a0a3100389dc850729673e6591a539693c1fe0.tar.gz
bcm5719-llvm-08a0a3100389dc850729673e6591a539693c1fe0.zip
[llvm-cov] Pass LineCoverageStats in SourceCoverageView. NFC.
Instead of copying around the wrapped segment and the list of line segments, just pass a reference to a LineCoverageStats object. This simplifies the interface. It also makes an upcoming change to suppress distracting highlights possible. llvm-svn: 316108
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageViewText.cpp')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageViewText.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index 6990ed0f160..83d228e3670 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -94,12 +94,14 @@ void SourceCoverageViewText::renderViewDivider(raw_ostream &OS,
OS << '\n';
}
-void SourceCoverageViewText::renderLine(
- raw_ostream &OS, LineRef L,
- const coverage::CoverageSegment *WrappedSegment,
- CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) {
+void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
+ const LineCoverageStats &LCS,
+ unsigned ExpansionCol,
+ unsigned ViewDepth) {
StringRef Line = L.Line;
unsigned LineNumber = L.LineNo;
+ auto *WrappedSegment = LCS.getWrappedSegment();
+ CoverageSegmentArray Segments = LCS.getLineSegments();
Optional<raw_ostream::Colors> Highlight;
SmallVector<std::pair<unsigned, unsigned>, 2> HighlightedRanges;
@@ -168,11 +170,14 @@ void SourceCoverageViewText::renderLineNumberColumn(raw_ostream &OS,
OS.indent(LineNumberColumnWidth - Str.size()) << Str << '|';
}
-void SourceCoverageViewText::renderRegionMarkers(
- raw_ostream &OS, CoverageSegmentArray Segments, unsigned ViewDepth) {
+void SourceCoverageViewText::renderRegionMarkers(raw_ostream &OS,
+ const LineCoverageStats &Line,
+ unsigned ViewDepth) {
renderLinePrefix(OS, ViewDepth);
OS.indent(getCombinedColumnWidth(getOptions()));
+ CoverageSegmentArray Segments = Line.getLineSegments();
+
// Just consider the segments which start *and* end on this line.
if (Segments.size() > 1)
Segments = Segments.drop_back();
@@ -196,12 +201,13 @@ void SourceCoverageViewText::renderRegionMarkers(
OS << '\n';
}
-void SourceCoverageViewText::renderExpansionSite(
- raw_ostream &OS, LineRef L, const coverage::CoverageSegment *WrappedSegment,
- CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) {
+void SourceCoverageViewText::renderExpansionSite(raw_ostream &OS, LineRef L,
+ const LineCoverageStats &LCS,
+ unsigned ExpansionCol,
+ unsigned ViewDepth) {
renderLinePrefix(OS, ViewDepth);
OS.indent(getCombinedColumnWidth(getOptions()) + (ViewDepth == 0 ? 0 : 1));
- renderLine(OS, L, WrappedSegment, Segments, ExpansionCol, ViewDepth);
+ renderLine(OS, L, LCS, ExpansionCol, ViewDepth);
}
void SourceCoverageViewText::renderExpansionView(raw_ostream &OS,
OpenPOWER on IntegriCloud