1 #include "llvm/Support/ScopedPrinter.h"
3 #include "llvm/ADT/StringExtras.h"
4 #include "llvm/Support/Format.h"
7 using namespace llvm::support;
11 raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value) {
12 OS << "0x" << to_hexString(Value.Value);
16 const std::string to_hexString(uint64_t Value, bool UpperCase) {
18 llvm::raw_string_ostream stream(number);
19 stream << format_hex_no_prefix(Value, 1, UpperCase);
23 void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
24 ArrayRef<uint8_t> Data, bool Block,
25 uint32_t StartOffset) {
35 OS << format_bytes_with_ascii(Data, StartOffset, 16, 4,
36 (IndentLevel + 1) * 2, true)
40 startLine() << Label << ":";
43 OS << " (" << format_bytes(Data, None, Data.size(), 1, 0, true) << ")\n";