[lldb][NFC] Make Stream's IndentLevel an unsigned integers.

We expect it to be always positive values and LLVM/Clang's IndentLevel
values are already unsigned integers, so we should do the same.
This commit is contained in:
Raphael Isemann 2019-12-02 12:44:55 +01:00
parent 510792a2e0
commit f8fb3729e9
3 changed files with 13 additions and 11 deletions

View File

@ -338,8 +338,8 @@ public:
/// 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 @@ public:
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 @@ public:
///
/// \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 @@ protected:
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);

View File

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

View File

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