#pragma once #include #include "llvm/ADT/StringRef.h" #include "Error.h" template <> struct std::formatter : std::formatter { using Base = std::formatter; template constexpr auto parse(ParseContext& ctx) { return Base::parse(ctx); } template auto format(llvm::StringRef s, FormatContext& ctx) const { return Base::format(std::string_view(s.str()), ctx); } }; template <> struct std::formatter : std::formatter { using Base = std::formatter; template constexpr auto parse(ParseContext& ctx) { return Base::parse(ctx); } template auto format(const llvm::Error& e, FormatContext& ctx) const { llvm::SmallString<128> buffer; llvm::raw_svector_ostream os(buffer); os << e; return Base::format(buffer, ctx); } };