23 #ifndef LLVM_SUPPORT_FORMAT_H 24 #define LLVM_SUPPORT_FORMAT_H 26 #include "llvm/STLExtras.h" 27 #include "llvm/StringRef.h" 45 virtual int snprint(
char *Buffer,
unsigned BufferSize)
const = 0;
53 unsigned print(
char *Buffer,
unsigned BufferSize)
const {
54 assert(BufferSize &&
"Invalid buffer size!");
57 int N =
snprint(Buffer, BufferSize);
61 return BufferSize * 2;
65 if (
unsigned(N) >= BufferSize)
78 template <
typename... Ts>
80 std::tuple<Ts...> Vals;
82 template <std::size_t... Is>
83 int snprint_tuple(
char *Buffer,
unsigned BufferSize,
86 return _snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
89 #pragma GCC diagnostic push 90 #pragma GCC diagnostic ignored "-Wformat-nonliteral" 92 return snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
94 #pragma GCC diagnostic pop 103 int snprint(
char *Buffer,
unsigned BufferSize)
const override {
117 template <
typename... Ts>
118 inline format_object<Ts...> format(
const char *Fmt,
const Ts &... Vals) {
131 : Str(S), Width(W), RightJustify(R) { }
161 : HexValue(HV), DecValue(DV), Width(W), Hex(H), Upper(U),
172 bool Upper =
false) {
173 assert(Width <= 18 &&
"hex width must be <= 18");
184 inline FormattedNumber format_hex_no_prefix(uint64_t N,
unsigned Width,
185 bool Upper =
false) {
186 assert(Width <= 16 &&
"hex width must be <= 16");
Alias for the common case of a sequence of size_ts.
Definition: STLExtras.h:269
Creates a compile-time integer sequence for a parameter pack.
Definition: STLExtras.h:278
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:33
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:42