diff options
| author | Zachary Turner <zturner@google.com> | 2017-03-11 02:45:50 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-03-11 02:45:50 +0000 |
| commit | d2efbae8e8e7df5c03ce2ecb361336ccdcdbd042 (patch) | |
| tree | 17177e0891bdb4751f469815a8ebd340b2b3281b | |
| parent | cac0a5971879533625fed92f6c7a9ff3c675cf55 (diff) | |
| download | bcm5719-llvm-d2efbae8e8e7df5c03ce2ecb361336ccdcdbd042.tar.gz bcm5719-llvm-d2efbae8e8e7df5c03ce2ecb361336ccdcdbd042.zip | |
[Support] Add a formatv provider for Twine.
llvm-svn: 297548
| -rw-r--r-- | llvm/include/llvm/Support/FormatProviders.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h index 54a37169d3a..ee0f4eb1b30 100644 --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/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<T> for llvm::Twine. +/// +/// This follows the same rules as the string formatter. + +template <> struct format_provider<Twine> { + static void format(const Twine &V, llvm::raw_ostream &Stream, + StringRef Style) { + format_provider<std::string>::format(V.str(), Stream, Style); + } +}; + /// Implementation of format_provider<T> for characters. /// /// The options string of a character type has the grammar: |

