summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/ScopedPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/ScopedPrinter.cpp')
-rw-r--r--contrib/llvm/lib/Support/ScopedPrinter.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/contrib/llvm/lib/Support/ScopedPrinter.cpp b/contrib/llvm/lib/Support/ScopedPrinter.cpp
index 0225f01..d8ee1ef 100644
--- a/contrib/llvm/lib/Support/ScopedPrinter.cpp
+++ b/contrib/llvm/lib/Support/ScopedPrinter.cpp
@@ -27,45 +27,18 @@ void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
if (Block) {
startLine() << Label;
- if (Str.size() > 0)
+ if (!Str.empty())
OS << ": " << Str;
OS << " (\n";
- for (size_t addr = 0, end = Data.size(); addr < end; addr += 16) {
- startLine() << format(" %04" PRIX64 ": ", uint64_t(addr));
- // Dump line of hex.
- for (size_t i = 0; i < 16; ++i) {
- if (i != 0 && i % 4 == 0)
- OS << ' ';
- if (addr + i < end)
- OS << hexdigit((Data[addr + i] >> 4) & 0xF, false)
- << hexdigit(Data[addr + i] & 0xF, false);
- else
- OS << " ";
- }
- // Print ascii.
- OS << " |";
- for (std::size_t i = 0; i < 16 && addr + i < end; ++i) {
- if (std::isprint(Data[addr + i] & 0xFF))
- OS << Data[addr + i];
- else
- OS << ".";
- }
- OS << "|\n";
- }
-
+ if (!Data.empty())
+ OS << format_bytes_with_ascii(Data, 0, 16, 4, (IndentLevel + 1) * 2, true)
+ << "\n";
startLine() << ")\n";
} else {
startLine() << Label << ":";
- if (Str.size() > 0)
+ if (!Str.empty())
OS << " " << Str;
- OS << " (";
- for (size_t i = 0; i < Data.size(); ++i) {
- if (i > 0)
- OS << " ";
-
- OS << format("%02X", static_cast<int>(Data[i]));
- }
- OS << ")\n";
+ OS << " (" << format_bytes(Data, None, Data.size(), 1, 0, true) << ")\n";
}
}
OpenPOWER on IntegriCloud