Skip to content

Commit

Permalink
[lldb][NFC] Remove Stream::Indent(const char *) overload in favor of …
Browse files Browse the repository at this point in the history
…the StringRef version
  • Loading branch information
Teemperor committed Feb 11, 2020
1 parent 363f05b commit 651936e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 2 additions & 4 deletions lldb/include/lldb/Utility/Stream.h
Expand Up @@ -270,10 +270,8 @@ class Stream {
/// optional string following the indentation spaces.
///
/// \param[in] s
/// A C string to print following the indentation. If nullptr, just
/// output the indentation characters.
size_t Indent(const char *s = nullptr);
size_t Indent(llvm::StringRef s);
/// A string to print following the indentation.
size_t Indent(llvm::StringRef s = "");

/// Decrement the current indentation level.
void IndentLess(unsigned amount = 2);
Expand Down
10 changes: 2 additions & 8 deletions lldb/source/Utility/Stream.cpp
Expand Up @@ -126,15 +126,9 @@ size_t Stream::PrintfVarArg(const char *format, va_list args) {
// Print and End of Line character to the stream
size_t Stream::EOL() { return PutChar('\n'); }

// Indent the current line using the current indentation level and print an
// optional string following the indentation spaces.
size_t Stream::Indent(const char *s) {
return Printf("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : "");
}

size_t Stream::Indent(llvm::StringRef str) {
return Printf("%*.*s%s", m_indent_level, m_indent_level, "",
str.str().c_str());
std::string indentation(m_indent_level, ' ');
return PutCString(indentation) + PutCString(str);
}

// Stream a character "ch" out to this stream.
Expand Down
3 changes: 2 additions & 1 deletion lldb/unittests/Utility/StreamTest.cpp
Expand Up @@ -148,7 +148,8 @@ TEST_F(StreamTest, SetIndentLevel) {

TEST_F(StreamTest, Indent) {
s.SetIndentLevel(2);
s.Indent(nullptr);
const char *nullptr_cstring = nullptr;
s.Indent(nullptr_cstring);
EXPECT_EQ(" ", TakeValue());

s.Indent("");
Expand Down

0 comments on commit 651936e

Please sign in to comment.