[lldb][NFC] Remove Stream::Indent(const char *) overload in favor of the StringRef version

This commit is contained in:
Raphael Isemann 2020-02-11 13:04:48 +01:00
parent 363f05b83d
commit 651936e5b6
3 changed files with 6 additions and 13 deletions

View File

@ -270,10 +270,8 @@ public:
/// 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);

View File

@ -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.

View File

@ -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("");