diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-12-05 14:41:09 +0100 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-12-05 14:41:33 +0100 |
commit | 1462f5a4c138bb20f38a579a29d12ab4e5fb6191 (patch) | |
tree | 38e08e27e5d8ec3843f65f9e09940d3635f69428 /lldb/source/Utility/Stream.cpp | |
parent | 18b72d337ef31bc4f1b898ceb17796ffe12dd104 (diff) | |
download | bcm5719-llvm-1462f5a4c138bb20f38a579a29d12ab4e5fb6191.tar.gz bcm5719-llvm-1462f5a4c138bb20f38a579a29d12ab4e5fb6191.zip |
[lldb][NFC] Move Address and AddressRange functions out of Stream and let them take raw_ostream
Summary:
Yet another step on the long road towards getting rid of lldb's Stream class.
We probably should just make this some kind of member of Address/AddressRange, but it seems quite often we just push
in random integers in there and this is just about getting rid of Stream and not improving arbitrary APIs.
I had to rename another `DumpAddress` function in FormatEntity that is dumping the content of an address to make Clang happy.
Reviewers: labath
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71052
Diffstat (limited to 'lldb/source/Utility/Stream.cpp')
-rw-r--r-- | lldb/source/Utility/Stream.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp index 2ef4cd78ab0..b336cb6b518 100644 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -11,6 +11,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/VASPrintf.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/Format.h" #include "llvm/Support/LEB128.h" #include <string> @@ -76,28 +77,27 @@ void Stream::QuotedCString(const char *cstr, const char *format) { // Put an address "addr" out to the stream with optional prefix and suffix // strings. -void Stream::Address(uint64_t addr, uint32_t addr_size, const char *prefix, - const char *suffix) { +void lldb_private::DumpAddress(llvm::raw_ostream &s, uint64_t addr, + uint32_t addr_size, const char *prefix, + const char *suffix) { if (prefix == nullptr) prefix = ""; if (suffix == nullptr) suffix = ""; - // int addr_width = m_addr_size << 1; - // Printf ("%s0x%0*" PRIx64 "%s", prefix, addr_width, addr, suffix); - Printf("%s0x%0*" PRIx64 "%s", prefix, addr_size * 2, addr, suffix); + s << prefix << llvm::format_hex(addr, 2 + 2 * addr_size) << suffix; } // Put an address range out to the stream with optional prefix and suffix // strings. -void Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, - uint32_t addr_size, const char *prefix, - const char *suffix) { +void lldb_private::DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, + uint64_t hi_addr, uint32_t addr_size, + const char *prefix, const char *suffix) { if (prefix && prefix[0]) - PutCString(prefix); - Address(lo_addr, addr_size, "["); - Address(hi_addr, addr_size, "-", ")"); + s << prefix; + DumpAddress(s, lo_addr, addr_size, "["); + DumpAddress(s, hi_addr, addr_size, "-", ")"); if (suffix && suffix[0]) - PutCString(suffix); + s << suffix; } size_t Stream::PutChar(char ch) { return Write(&ch, 1); } |