Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Support/ScopedPrinter.cpp
Line
Count
Source (jump to first uncovered line)
1
#include "llvm/Support/ScopedPrinter.h"
2
3
#include "llvm/Support/Format.h"
4
#include <cctype>
5
6
using namespace llvm::support;
7
8
namespace llvm {
9
10
2.53M
raw_ostream &operator<<(raw_ostream &OS, const HexNumber &Value) {
11
2.53M
  OS << "0x" << to_hexString(Value.Value);
12
2.53M
  return OS;
13
2.53M
}
14
15
2.53M
const std::string to_hexString(uint64_t Value, bool UpperCase) {
16
2.53M
  std::string number;
17
2.53M
  llvm::raw_string_ostream stream(number);
18
2.53M
  stream << format_hex_no_prefix(Value, 1, UpperCase);
19
2.53M
  return stream.str();
20
2.53M
}
21
22
void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
23
                                    ArrayRef<uint8_t> Data, bool Block,
24
5.69k
                                    uint32_t StartOffset) {
25
5.69k
  if (Data.size() > 16)
26
1.37k
    Block = true;
27
5.69k
28
5.69k
  if (Block) {
29
2.75k
    startLine() << Label;
30
2.75k
    if (!Str.empty())
31
0
      OS << ": " << Str;
32
2.75k
    OS << " (\n";
33
2.75k
    if (!Data.empty())
34
2.17k
      OS << format_bytes_with_ascii(Data, StartOffset, 16, 4,
35
2.17k
                                    (IndentLevel + 1) * 2, true)
36
2.17k
         << "\n";
37
2.75k
    startLine() << ")\n";
38
2.94k
  } else {
39
2.94k
    startLine() << Label << ":";
40
2.94k
    if (!Str.empty())
41
1.59k
      OS << " " << Str;
42
2.94k
    OS << " (" << format_bytes(Data, None, Data.size(), 1, 0, true) << ")\n";
43
2.94k
  }
44
5.69k
}
45
46
} // namespace llvm