diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h index 88cdb88d77adf..9982d8236a652 100644 --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -338,8 +338,8 @@ class Stream { /// Get the current indentation level. /// /// \return - /// The current indentation level as an integer. - int GetIndentLevel() const; + /// The current indentation level. + unsigned GetIndentLevel() const; /// Indent the current line in the stream. /// @@ -353,10 +353,10 @@ class Stream { size_t Indent(llvm::StringRef s); /// Decrement the current indentation level. - void IndentLess(int amount = 2); + void IndentLess(unsigned amount = 2); /// Increment the current indentation level. - void IndentMore(int amount = 2); + void IndentMore(unsigned amount = 2); /// Output an offset value. /// @@ -411,7 +411,7 @@ class Stream { /// /// \param[in] level /// The new indentation level. - void SetIndentLevel(int level); + void SetIndentLevel(unsigned level); /// Output a SLEB128 number to the stream. /// @@ -442,7 +442,7 @@ class Stream { uint32_t m_addr_size; ///< Size of an address in bytes. lldb::ByteOrder m_byte_order; ///< Byte order to use when encoding scalar types. - int m_indent_level; ///< Indention level. + unsigned m_indent_level; ///< Indention level. std::size_t m_bytes_written = 0; ///< Number of bytes written so far. void _PutHex8(uint8_t uvalue, bool add_prefix); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 4b9a1b77ad16d..aeb77b7cf676a 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3177,7 +3177,7 @@ void Target::StopHook::SetThreadSpecifier(ThreadSpec *specifier) { void Target::StopHook::GetDescription(Stream *s, lldb::DescriptionLevel level) const { - int indent_level = s->GetIndentLevel(); + unsigned indent_level = s->GetIndentLevel(); s->SetIndentLevel(indent_level + 2); diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp index 991f7e924d8dd..119d1e0f79643 100644 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -185,16 +185,18 @@ Stream &Stream::operator<<(int64_t sval) { } // Get the current indentation level -int Stream::GetIndentLevel() const { return m_indent_level; } +unsigned Stream::GetIndentLevel() const { return m_indent_level; } // Set the current indentation level -void Stream::SetIndentLevel(int indent_level) { m_indent_level = indent_level; } +void Stream::SetIndentLevel(unsigned indent_level) { + m_indent_level = indent_level; +} // Increment the current indentation level -void Stream::IndentMore(int amount) { m_indent_level += amount; } +void Stream::IndentMore(unsigned amount) { m_indent_level += amount; } // Decrement the current indentation level -void Stream::IndentLess(int amount) { +void Stream::IndentLess(unsigned amount) { if (m_indent_level >= amount) m_indent_level -= amount; else