llvm/llvm/include/llvm/Support/FormatAdapters.h

//===- FormatAdapters.h - Formatters for common LLVM types -----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SUPPORT_FORMATADAPTERS_H
#define LLVM_SUPPORT_FORMATADAPTERS_H

#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatCommon.h"
#include "llvm/Support/FormatVariadicDetails.h"
#include "llvm/Support/raw_ostream.h"

namespace llvm {
template <typename T>
class FormatAdapter : public support::detail::format_adapter {};

namespace support {
namespace detail {
template <typename T> class AlignAdapter final : public FormatAdapter<T> {};

template <typename T> class PadAdapter final : public FormatAdapter<T> {};

template <typename T> class RepeatAdapter final : public FormatAdapter<T> {};

class ErrorAdapter : public FormatAdapter<Error> {};
} // namespace detail
} // namespace support

template <typename T>
support::detail::AlignAdapter<T> fmt_align(T &&Item, AlignStyle Where,
                                           size_t Amount, char Fill = ' ') {}

template <typename T>
support::detail::PadAdapter<T> fmt_pad(T &&Item, size_t Left, size_t Right) {}

template <typename T>
support::detail::RepeatAdapter<T> fmt_repeat(T &&Item, size_t Count) {}

// llvm::Error values must be consumed before being destroyed.
// Wrapping an error in fmt_consume explicitly indicates that the formatv_object
// should take ownership and consume it.
inline support::detail::ErrorAdapter fmt_consume(Error &&Item) {}
}

#endif