From 9c4a13d7e8a47d417cc089644cc06c81c590e33f Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sat, 11 Mar 2017 02:45:50 +0000 Subject: [PATCH] [Support] Add a formatv provider for Twine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297548 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/FormatProviders.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/Support/FormatProviders.h b/include/llvm/Support/FormatProviders.h index 54a37169d3a..ee0f4eb1b30 100644 --- a/include/llvm/Support/FormatProviders.h +++ b/include/llvm/Support/FormatProviders.h @@ -18,6 +18,7 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/FormatVariadicDetails.h" #include "llvm/Support/NativeFormatting.h" @@ -209,6 +210,17 @@ struct format_provider< } }; +/// Implementation of format_provider for llvm::Twine. +/// +/// This follows the same rules as the string formatter. + +template <> struct format_provider { + static void format(const Twine &V, llvm::raw_ostream &Stream, + StringRef Style) { + format_provider::format(V.str(), Stream, Style); + } +}; + /// Implementation of format_provider for characters. /// /// The options string of a character type has the grammar: -- 2.50.1