mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-05 09:24:28 +00:00
LineIterator: Provide a variant that keeps blank lines
It isn't always useful to skip blank lines, as evidenced by the somewhat awkward use of line_iterator in llvm-cov. This adds a knob to control whether or not to skip blanks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217960 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -206,7 +206,7 @@ void SourceCoverageView::render(raw_ostream &OS, unsigned IndentLevel) {
|
||||
size_t CurrentHighlightRange = 0;
|
||||
size_t CurrentRegionMarker = 0;
|
||||
|
||||
line_iterator Lines(File);
|
||||
line_iterator Lines(File, /*SkipBlanks=*/false);
|
||||
// Advance the line iterator to the first line.
|
||||
while (Lines.line_number() < LineOffset)
|
||||
++Lines;
|
||||
@ -228,8 +228,9 @@ void SourceCoverageView::render(raw_ostream &OS, unsigned IndentLevel) {
|
||||
auto NextISV = InstantiationSubViews.begin();
|
||||
auto EndISV = InstantiationSubViews.end();
|
||||
|
||||
for (size_t I = 0, E = LineStats.size(); I < E; ++I) {
|
||||
unsigned LineNo = I + LineOffset;
|
||||
for (size_t I = 0, E = LineStats.size(); I < E && !Lines.is_at_eof();
|
||||
++I, ++Lines) {
|
||||
unsigned LineNo = Lines.line_number();
|
||||
|
||||
renderIndent(OS, IndentLevel);
|
||||
if (Options.ShowLineStats)
|
||||
@ -252,11 +253,6 @@ void SourceCoverageView::render(raw_ostream &OS, unsigned IndentLevel) {
|
||||
|
||||
// Display the source code for the current line.
|
||||
StringRef Line = *Lines;
|
||||
// Check if the line is empty, as line_iterator skips blank lines.
|
||||
if (LineNo < Lines.line_number())
|
||||
Line = "";
|
||||
else if (!Lines.is_at_eof())
|
||||
++Lines;
|
||||
renderLine(OS, Line, LineRanges);
|
||||
|
||||
// Show the region markers.
|
||||
|
Reference in New Issue
Block a user