LLVM: lib/ObjectYAML/YAML.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
17#include
18#include
19
20using namespace llvm;
21
25}
26
29 if (Scalar.size() % 2 != 0)
30 return "BinaryRef hex string must contain an even number of nybbles.";
31
32
34 return "BinaryRef hex string must contain only hex digits.";
36 return {};
37}
38
40 if (!DataIsHexString) {
41 OS.write((const char *)Data.data(), std::min<uint64_t>(N, Data.size()));
42 return;
43 }
44
45 for (uint64_t I = 0, E = std::min<uint64_t>(N, Data.size() / 2); I != E;
46 ++I) {
48 Byte <<= 4;
51 }
52}
53
56 return;
57 if (DataIsHexString) {
58 OS.write((const char *)Data.data(), Data.size());
59 return;
60 }
63}
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write(unsigned char C)
Specialized YAMLIO scalar type for representing a binary blob.
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef.
LLVM_ABI void writeAsHex(raw_ostream &OS) const
Write the contents (regardless of whether it is binary or a hex string) as hex to the given raw_ostre...
Definition YAML.cpp:54
LLVM_ABI void writeAsBinary(raw_ostream &OS, uint64_t N=UINT64_MAX) const
Write the contents (regardless of whether it is binary or a hex string) as binary to the given raw_os...
Definition YAML.cpp:39
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
unsigned hexDigitValue(char C)
Interpret the given character C as a hexadecimal digit and return its value.
char hexdigit(unsigned X, bool LowerCase=false)
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).
bool isHexDigit(char C)
Checks if character C is a hexadecimal numeric character.
This class should be specialized by type that requires custom conversion to/from a yaml scalar.