26 #ifndef LLVM_SUPPORT_FORMATVARIADIC_H 27 #define LLVM_SUPPORT_FORMATVARIADIC_H 54 Where(Where), Pad(Pad), Options(Options) {}
75 template <
typename... Ts>
76 std::vector<detail::format_adapter *>
operator()(Ts &... Items) {
77 return std::vector<detail::format_adapter *>{&Items...};
82 std::vector<detail::format_adapter *>
Adapters;
86 size_t &
Align,
char &Pad);
88 static std::pair<ReplacementItem, StringRef>
89 splitLiteralAndReplacement(
StringRef Fmt);
93 : Fmt(Fmt), Replacements(parseFormatString(Fmt)) {
94 Adapters.reserve(ParamCount);
100 : Fmt(
std::move(rhs.Fmt)),
102 Replacements(
std::move(rhs.Replacements)) {
103 Adapters.reserve(rhs.
Adapters.size());
107 for (
auto &R : Replacements) {
114 if (R.Index >= Adapters.size()) {
119 auto W = Adapters[R.Index];
122 Align.
format(S, R.Options);
125 static std::vector<ReplacementItem> parseFormatString(
StringRef Fmt);
146 operator std::string()
const {
return str(); }
158 Parameters(
std::move(Params)) {
166 Parameters(
std::move(rhs.Parameters)) {
253 template <
typename... Ts>
256 using ParamTuple = decltype(
265 #endif // LLVM_SUPPORT_FORMATVARIADIC_H
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
ReplacementItem(StringRef Literal)
This class represents lattice values for constants.
A raw_ostream that writes to an SmallVector or SmallString.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
void format(raw_ostream &S, StringRef Options)
auto apply_tuple(F &&f, Tuple &&t) -> decltype(detail::apply_tuple_impl(std::forward< F >(f), std::forward< Tuple >(t), build_index_impl< std::tuple_size< typename std::decay< Tuple >::type >::value >
Given an input tuple (a1, a2, ..., an), pass the arguments of the tuple variadically to f as if by ca...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
The instances of the Type class are immutable: once they are created, they are never changed...
ReplacementItem(StringRef Spec, size_t Index, size_t Align, AlignStyle Where, char Pad, StringRef Options)
std::enable_if< uses_format_member< T >::value, T >::type build_format_adapter(T &&Item)
A raw_ostream that writes to an std::string.
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.