diff options
author | Raphael Isemann <teemperor@gmail.com> | 2018-09-13 09:19:40 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2018-09-13 09:19:40 +0000 |
commit | 7e9649b86fdecf3ddae119a28f93f8a803dc1006 (patch) | |
tree | 2b3b6f6268fc17141414a261c51d14d83c6d22ff /lldb/source/Core/SourceManager.cpp | |
parent | 4d302f6911f510153a026274b21eb9fb2c260903 (diff) | |
download | bcm5719-llvm-7e9649b86fdecf3ddae119a28f93f8a803dc1006.tar.gz bcm5719-llvm-7e9649b86fdecf3ddae119a28f93f8a803dc1006.zip |
Remove byte counting from SourceManager [NFC]
Summary:
Similar to what we did in D50681, we now stop manually byte counting here
in the SourceManager.
Reviewers: #lldb, JDevlieghere
Reviewed By: #lldb, JDevlieghere
Subscribers: JDevlieghere, abidh, lldb-commits
Differential Revision: https://reviews.llvm.org/D50809
llvm-svn: 342121
Diffstat (limited to 'lldb/source/Core/SourceManager.cpp')
-rw-r--r-- | lldb/source/Core/SourceManager.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 413505d3ba8..5522852104d 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -158,7 +158,9 @@ size_t SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile( const SymbolContextList *bp_locs) { if (count == 0) return 0; - size_t return_value = 0; + + Stream::ByteDelta delta(*s); + if (start_line == 0) { if (m_last_line != 0 && m_last_line != UINT32_MAX) start_line = m_last_line + m_last_count; @@ -193,9 +195,8 @@ size_t SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile( ::snprintf(prefix, sizeof(prefix), " "); } - return_value += - s->Printf("%s%2.2s %-4u\t", prefix, - line == curr_line ? current_line_cstr : "", line); + s->Printf("%s%2.2s %-4u\t", prefix, + line == curr_line ? current_line_cstr : "", line); // So far we treated column 0 as a special 'no column value', but // DisplaySourceLines starts counting columns from 0 (and no column is @@ -211,21 +212,20 @@ size_t SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile( // Display caret cursor. std::string src_line; m_last_file_sp->GetLine(line, src_line); - return_value += s->Printf(" \t"); + s->Printf(" \t"); // Insert a space for every non-tab character in the source line. for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i) - return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' '); + s->PutChar(src_line[i] == '\t' ? '\t' : ' '); // Now add the caret. - return_value += s->Printf("^\n"); + s->Printf("^\n"); } if (this_line_size == 0) { m_last_line = UINT32_MAX; break; - } else - return_value += this_line_size; + } } } - return return_value; + return *delta; } size_t SourceManager::DisplaySourceLinesWithLineNumbers( |