[llvm] r367484 - [NFC] allow creating error strings from a Twine

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 14:09:53 PDT 2019


Author: jfb
Date: Wed Jul 31 14:09:53 2019
New Revision: 367484

URL: http://llvm.org/viewvc/llvm-project?rev=367484&view=rev
Log:
[NFC] allow creating error strings from a Twine

It's useful when no format needs to happen, only the Twine needs to be put together.

Modified:
    llvm/trunk/include/llvm/Support/Error.h

Modified: llvm/trunk/include/llvm/Support/Error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=367484&r1=367483&r2=367484&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Error.h (original)
+++ llvm/trunk/include/llvm/Support/Error.h Wed Jul 31 14:09:53 2019
@@ -1170,6 +1170,10 @@ inline Error createStringError(std::erro
 
 Error createStringError(std::error_code EC, char const *Msg);
 
+static inline Error createStringError(std::error_code EC, const Twine &S) {
+  return createStringError(EC, S.str().c_str());
+}
+
 template <typename... Ts>
 inline Error createStringError(std::errc EC, char const *Fmt,
                                const Ts &... Vals) {




More information about the llvm-commits mailing list