summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageView.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-06-24 00:41:26 +0000
committerVedant Kumar <vsk@apple.com>2016-06-24 00:41:26 +0000
commit1c4f588df7c6d32f2b223d37d5424a290cdc62ee (patch)
tree363f2881fcb1d265fab39e809684bc33104b376b /llvm/tools/llvm-cov/SourceCoverageView.cpp
parent9d70d0b5ffe1e920ff28d506c8ddaefc5c51bb94 (diff)
downloadbcm5719-llvm-1c4f588df7c6d32f2b223d37d5424a290cdc62ee.tar.gz
bcm5719-llvm-1c4f588df7c6d32f2b223d37d5424a290cdc62ee.zip
[llvm-cov] Use getOptions() instead of Options in SourceCoverageView, NFC
A lot of this code is going to move into the text-based coverage renderer, and won't be able to use Options directly. Use the getter. llvm-svn: 273635
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp
index fb5dcb325ca..8aa99295a0f 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp
@@ -36,9 +36,10 @@ void SourceCoverageView::renderLine(
for (const auto *S : Segments) {
unsigned End = std::min(S->Col, static_cast<unsigned>(Line.size()) + 1);
colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
- Options.Colors && Highlight, /*Bold=*/false, /*BG=*/true)
+ getOptions().Colors && Highlight, /*Bold=*/false,
+ /*BG=*/true)
<< Line.substr(Col - 1, End - Col);
- if (Options.Debug && Highlight)
+ if (getOptions().Debug && Highlight)
HighlightedRanges.push_back(std::make_pair(Col, End));
Col = End;
if (Col == ExpansionCol)
@@ -51,11 +52,11 @@ void SourceCoverageView::renderLine(
// Show the rest of the line
colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
- Options.Colors && Highlight, /*Bold=*/false, /*BG=*/true)
+ getOptions().Colors && Highlight, /*Bold=*/false, /*BG=*/true)
<< Line.substr(Col - 1, Line.size() - Col + 1);
OS << "\n";
- if (Options.Debug) {
+ if (getOptions().Debug) {
for (const auto &Range : HighlightedRanges)
errs() << "Highlighted line " << LineNumber << ", " << Range.first
<< " -> " << Range.second << "\n";
@@ -104,7 +105,7 @@ SourceCoverageView::renderLineCoverageColumn(raw_ostream &OS,
std::string C = formatCount(Line.ExecutionCount);
OS.indent(LineCoverageColumnWidth - C.size());
colored_ostream(OS, raw_ostream::MAGENTA,
- Line.hasMultipleRegions() && Options.Colors)
+ Line.hasMultipleRegions() && getOptions().Colors)
<< C;
OS << '|';
}
@@ -136,7 +137,7 @@ void SourceCoverageView::renderRegionMarkers(
}
OS << "\n";
- if (Options.Debug)
+ if (getOptions().Debug)
for (const auto *S : Segments)
errs() << "Marker at " << S->Line << ":" << S->Col << " = "
<< formatCount(S->Count) << (S->IsRegionEntry ? "\n" : " (pop)\n");
@@ -146,8 +147,8 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile,
unsigned IndentLevel) {
// The width of the leading columns
unsigned CombinedColumnWidth =
- (Options.ShowLineStats ? LineCoverageColumnWidth + 1 : 0) +
- (Options.ShowLineNumbers ? LineNumberColumnWidth + 1 : 0);
+ (getOptions().ShowLineStats ? LineCoverageColumnWidth + 1 : 0) +
+ (getOptions().ShowLineNumbers ? LineNumberColumnWidth + 1 : 0);
// The width of the line that is used to divide between the view and the
// subviews.
unsigned DividerWidth = CombinedColumnWidth + 4;
@@ -195,15 +196,15 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile,
// Render the line prefix.
renderIndent(OS, IndentLevel);
- if (Options.ShowLineStats)
+ if (getOptions().ShowLineStats)
renderLineCoverageColumn(OS, LineCount);
- if (Options.ShowLineNumbers)
+ if (getOptions().ShowLineNumbers)
renderLineNumberColumn(OS, LI.line_number());
// If there are expansion subviews, we want to highlight the first one.
unsigned ExpansionColumn = 0;
if (NextESV != EndESV && NextESV->getLine() == LI.line_number() &&
- Options.Colors)
+ getOptions().Colors)
ExpansionColumn = NextESV->getStartCol();
// Display the source code for the current line.
@@ -211,8 +212,9 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile,
ExpansionColumn);
// Show the region markers.
- if (Options.ShowRegionMarkers && (!Options.ShowLineStatsOrRegionMarkers ||
- LineCount.hasMultipleRegions()) &&
+ if (getOptions().ShowRegionMarkers &&
+ (!getOptions().ShowLineStatsOrRegionMarkers ||
+ LineCount.hasMultipleRegions()) &&
!LineSegments.empty()) {
renderIndent(OS, IndentLevel);
OS.indent(CombinedColumnWidth);
@@ -238,7 +240,7 @@ void SourceCoverageView::render(raw_ostream &OS, bool WholeFile,
OS << "\n";
}
// Render the child subview
- if (Options.Debug)
+ if (getOptions().Debug)
errs() << "Expansion at line " << NextESV->getLine() << ", "
<< NextESV->getStartCol() << " -> " << NextESV->getEndCol()
<< "\n";
OpenPOWER on IntegriCloud