23 #ifndef LLVM_SUPPORT_FORMAT_H
24 #define LLVM_SUPPORT_FORMAT_H
29 #include "llvm/Support/DataTypes.h"
46 virtual int snprint(
char *Buffer,
unsigned BufferSize)
const = 0;
54 unsigned print(
char *Buffer,
unsigned BufferSize)
const {
55 assert(BufferSize &&
"Invalid buffer size!");
62 return BufferSize * 2;
66 if (
unsigned(N) >= BufferSize)
81 template <
typename Arg,
typename...
Args>
83 static_assert(std::is_scalar<Arg>::value,
84 "format can't be used with non fundamental / non pointer type");
89 template <
typename... Ts>
91 std::tuple<Ts...> Vals;
93 template <std::size_t... Is>
94 int snprint_tuple(
char *Buffer,
unsigned BufferSize,
97 return _snprintf(Buffer, BufferSize,
Fmt, std::get<Is>(Vals)...);
99 return snprintf(Buffer, BufferSize,
Fmt, std::get<Is>(Vals)...);
109 int snprint(
char *Buffer,
unsigned BufferSize)
const override {
123 template <
typename... Ts>
137 : Str(S), Width(W), RightJustify(R) { }
167 : HexValue(HV), DecValue(DV), Width(W), Hex(H), Upper(U),
178 bool Upper =
false) {
179 assert(Width <= 18 &&
"hex width must be <= 18");
191 bool Upper =
false) {
192 assert(Width <= 16 &&
"hex width must be <= 16");
213 uint8_t ByteGroupSize;
220 uint32_t NPL, uint8_t BGS,
bool U,
bool A)
221 : Bytes(B), FirstByteOffset(O), IndentLevel(IL), NumPerLine(NPL),
222 ByteGroupSize(BGS), Upper(U),
ASCII(A) {
224 if (ByteGroupSize > NumPerLine)
225 ByteGroupSize = NumPerLine;
229 inline FormattedBytes
231 uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4,
232 uint32_t IndentLevel = 0,
bool Upper =
false) {
233 return FormattedBytes(Bytes, IndentLevel, FirstByteOffset, NumPerLine,
234 ByteGroupSize,
Upper,
false);
237 inline FormattedBytes
240 uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4,
241 uint32_t IndentLevel = 0,
bool Upper =
false) {
242 return FormattedBytes(Bytes, IndentLevel, FirstByteOffset, NumPerLine,
243 ByteGroupSize,
Upper,
true);
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
FormattedBytes format_bytes_with_ascii(ArrayRef< uint8_t > Bytes, Optional< uint64_t > FirstByteOffset=None, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
FormattedBytes format_bytes(ArrayRef< uint8_t > Bytes, Optional< uint64_t > FirstByteOffset=None, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
Alias for the common case of a sequence of size_ts.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
FormattedString right_justify(StringRef Str, unsigned Width)
right_justify - add spaces before string so total output is Width characters.
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with etc Experimental Use value profile to guide fuzzing Number of simultaneous worker processes to run the jobs If Reload the main corpus every< N > seconds to get new units discovered by other processes disabled generate only ASCII(isprint+isspace) inputs.") FUZZER_FLAG_STRING(artifact_prefix
Creates a compile-time integer sequence for a parameter pack.
FormattedNumber format_decimal(int64_t N, unsigned Width)
format_decimal - Output N as a right justified, fixed-width decimal.
FormattedNumber format_hex_no_prefix(uint64_t N, unsigned Width, bool Upper=false)
format_hex_no_prefix - Output N as a fixed width hexadecimal.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")