summaryrefslogtreecommitdiff
path: root/include/llvm/Support/FormatVariadic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/FormatVariadic.h')
-rw-r--r--include/llvm/Support/FormatVariadic.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Support/FormatVariadic.h b/include/llvm/Support/FormatVariadic.h
index 408c6d8b2e0d2..8c08a7d9488f6 100644
--- a/include/llvm/Support/FormatVariadic.h
+++ b/include/llvm/Support/FormatVariadic.h
@@ -230,9 +230,8 @@ public:
// For a given parameter of type T, the following steps are executed in order
// until a match is found:
//
-// 1. If the parameter is of class type, and contains a method
-// void format(raw_ostream &Stream, StringRef Options)
-// Then this method is invoked to produce the formatted output. The
+// 1. If the parameter is of class type, and inherits from format_adapter,
+// Then format() is invoked on it to produce the formatted output. The
// implementation should write the formatted text into `Stream`.
// 2. If there is a suitable template specialization of format_provider<>
// for type T containing a method whose signature is:
@@ -259,6 +258,13 @@ inline auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object<decltype(
std::make_tuple(detail::build_format_adapter(std::forward<Ts>(Vals))...));
}
+// Allow a formatv_object to be formatted (no options supported).
+template <typename T> struct format_provider<formatv_object<T>> {
+ static void format(const formatv_object<T> &V, raw_ostream &OS, StringRef) {
+ OS << V;
+ }
+};
+
} // end namespace llvm
#endif // LLVM_SUPPORT_FORMATVARIADIC_H