LLVM 19.0.0git
ScopedPrinter.cpp
Go to the documentation of this file.
2
4
5using namespace llvm::support;
6
7namespace llvm {
8
10 OS << "0x" << utohexstr(Value.Value);
11 return OS;
12}
13
14void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
16 uint32_t StartOffset) {
17 if (Data.size() > 16)
18 Block = true;
19
20 if (Block) {
21 startLine() << Label;
22 if (!Str.empty())
23 OS << ": " << Str;
24 OS << " (\n";
25 if (!Data.empty())
26 OS << format_bytes_with_ascii(Data, StartOffset, 16, 4,
27 (IndentLevel + 1) * 2, true)
28 << "\n";
29 startLine() << ")\n";
30 } else {
31 startLine() << Label << ":";
32 if (!Str.empty())
33 OS << " " << Str;
34 OS << " (" << format_bytes(Data, std::nullopt, Data.size(), 1, 0, true)
35 << ")\n";
36 }
37}
38
40 raw_ostream &OS, bool PrettyPrint,
41 std::unique_ptr<DelimitedScope> &&OuterScope)
43 JOS(OS, /*Indent=*/PrettyPrint ? 2 : 0),
44 OuterScope(std::move(OuterScope)) {
45 if (this->OuterScope)
46 this->OuterScope->setPrinter(*this);
47}
48
49} // namespace llvm
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
JSONScopedPrinter(raw_ostream &OS, bool PrettyPrint=false, std::unique_ptr< DelimitedScope > &&OuterScope=std::unique_ptr< DelimitedScope >{})
virtual raw_ostream & startLine()
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
Value(Type *Ty, unsigned scid)
Definition: Value.cpp:53
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FormattedBytes format_bytes_with_ascii(ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
Definition: Format.h:250
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1858
FormattedBytes format_bytes(ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
Definition: Format.h:241
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858