diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -213,45 +213,10 @@ /// in one statement. Stream &operator<<(char ch); - /// Output a uint8_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint8_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint8_t uval); - - /// Output a uint16_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint16_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint16_t uval); - - /// Output a uint32_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint32_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint32_t uval); - - /// Output a uint64_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint64_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint64_t uval); + Stream &operator<<(uint8_t uval) = delete; + Stream &operator<<(uint16_t uval) = delete; + Stream &operator<<(uint32_t uval) = delete; + Stream &operator<<(uint64_t uval) = delete; /// Output a int8_t \a sval to the stream \a s. /// diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -146,7 +146,7 @@ // We have a new base address if (count > 0) s->PutCString(", "); - *s << "base_addr = " << end_addr_offset; + s->Format("base_addr = {0:x}", end_addr_offset); } } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -315,14 +315,14 @@ s->Indent(); *s << "CompileUnit = " << comp_unit; if (comp_unit != nullptr) - *s << " {0x" << comp_unit->GetID() << "} " - << *(static_cast(comp_unit)); + s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(), + *static_cast(comp_unit)); s->EOL(); s->Indent(); *s << "Function = " << function; if (function != nullptr) { - *s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() - << ", address-range = "; + s->Format(" {{{0:x-16}} {1}, address-range = ", function->GetID(), + function->GetType()->GetName()); function->GetAddressRange().Dump(s, target, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress); s->EOL(); @@ -337,10 +337,7 @@ s->Indent(); *s << "Block = " << block; if (block != nullptr) - *s << " {0x" << block->GetID() << '}'; - // Dump the block and pass it a negative depth to we print all the parent - // blocks if (block != NULL) - // block->Dump(s, function->GetFileAddress(), INT_MIN); + s->Format(" {{{0:x-16}}", block->GetID()); s->EOL(); s->Indent(); *s << "LineEntry = "; @@ -354,7 +351,8 @@ s->EOL(); *s << "Variable = " << variable; if (variable != nullptr) { - *s << " {0x" << variable->GetID() << "} " << variable->GetType()->GetName(); + s->Format(" {{{0:x-16}} {1}", variable->GetID(), + variable->GetType()->GetName()); s->EOL(); } s->IndentLess(); diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -255,7 +255,7 @@ *s << ", compiler_type = " << m_compiler_type.GetOpaqueQualType() << ' '; GetForwardCompilerType().DumpTypeDescription(s); } else if (m_encoding_uid != LLDB_INVALID_UID) { - *s << ", type_data = " << (uint64_t)m_encoding_uid; + s->Format(", type_data = {0:x-16}", m_encoding_uid); switch (m_encoding_uid_type) { case eEncodingInvalid: break; diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -112,7 +112,7 @@ if (m_symfile_type_sp) { Type *type = m_symfile_type_sp->GetType(); if (type) { - *s << ", type = {" << type->GetID() << "} " << (void *)type << " ("; + s->Format(", type = {{{0:x-16}} {1} (", type->GetID(), type); type->DumpTypeName(s); s->PutChar(')'); } diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -160,30 +160,6 @@ return *this; } -// Stream a uint8_t "uval" out to this stream. -Stream &Stream::operator<<(uint8_t uval) { - PutHex8(uval); - return *this; -} - -// Stream a uint16_t "uval" out to this stream. -Stream &Stream::operator<<(uint16_t uval) { - PutHex16(uval, m_byte_order); - return *this; -} - -// Stream a uint32_t "uval" out to this stream. -Stream &Stream::operator<<(uint32_t uval) { - PutHex32(uval, m_byte_order); - return *this; -} - -// Stream a uint64_t "uval" out to this stream. -Stream &Stream::operator<<(uint64_t uval) { - PutHex64(uval, m_byte_order); - return *this; -} - // Stream a int8_t "sval" out to this stream. Stream &Stream::operator<<(int8_t sval) { Printf("%i", static_cast(sval)); diff --git a/lldb/test/Shell/SymbolFile/DWARF/array-sizes.s b/lldb/test/Shell/SymbolFile/DWARF/array-sizes.s --- a/lldb/test/Shell/SymbolFile/DWARF/array-sizes.s +++ b/lldb/test/Shell/SymbolFile/DWARF/array-sizes.s @@ -10,7 +10,7 @@ # RUN: lldb-test symbols %t | FileCheck %s # CHECK: Variable{0x7fffffff0000001e}, name = "X" -# CHECK-SAME: type = {7fffffff00000033} 0x{{[0-9a-f]*}} (char [56]) +# CHECK-SAME: type = {7fffffff00000033} 0x{{[0-9A-F]*}} (char [56]) # Generated from "char X[47];" diff --git a/lldb/unittests/Utility/StreamTest.cpp b/lldb/unittests/Utility/StreamTest.cpp --- a/lldb/unittests/Utility/StreamTest.cpp +++ b/lldb/unittests/Utility/StreamTest.cpp @@ -304,15 +304,6 @@ EXPECT_EQ("127 32767 2147483647 9223372036854775807", TakeValue()); } -TEST_F(StreamTest, ShiftOperatorUInts) { - s << std::numeric_limits::max() << " "; - s << std::numeric_limits::max() << " "; - s << std::numeric_limits::max() << " "; - s << std::numeric_limits::max(); - EXPECT_EQ(33U, s.GetWrittenBytes()); - EXPECT_EQ("ff ffff ffffffff ffffffffffffffff", TakeValue()); -} - TEST_F(StreamTest, ShiftOperatorPtr) { // This test is a bit tricky because pretty much everything related to // pointer printing seems to lead to UB or IB. So let's make the most basic