[llvm-branch-commits] [llvm] 784cd68 - Revert "[Support] Introduce formatv variant of createStringError (#80493)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Feb 17 12:00:15 PST 2024


Author: Alex Langford
Date: 2024-02-17T12:00:10-08:00
New Revision: 784cd6883d930be89ad8fc114364f575cf1f5766

URL: https://github.com/llvm/llvm-project/commit/784cd6883d930be89ad8fc114364f575cf1f5766
DIFF: https://github.com/llvm/llvm-project/commit/784cd6883d930be89ad8fc114364f575cf1f5766.diff

LOG: Revert "[Support] Introduce formatv variant of createStringError (#80493)"

This reverts commit 4bb0ca655bb65aae0a1d251ba5053aadff678101.

Added: 
    

Modified: 
    llvm/include/llvm/Support/Error.h
    llvm/unittests/Support/ErrorTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index ddc1afb9623097..bb4f38f7ec355e 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -22,7 +22,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
-#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cstdint>
@@ -1262,15 +1261,6 @@ inline Error createStringError(std::errc EC, char const *Fmt,
   return createStringError(std::make_error_code(EC), Fmt, Vals...);
 }
 
-template <typename... Ts>
-inline Error createStringErrorV(std::error_code EC, const char *Fmt,
-                                const Ts &...Vals) {
-  std::string Buffer;
-  raw_string_ostream Stream(Buffer);
-  Stream << formatv(Fmt, Vals...);
-  return make_error<StringError>(Stream.str(), EC);
-}
-
 /// This class wraps a filename and another Error.
 ///
 /// In some cases, an error needs to live along a 'source' name, in order to

diff  --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index a700a50e1d4337..11f93203597bf0 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -472,23 +472,6 @@ TEST(Error, createStringError) {
     << "Failed to convert createStringError() result to error_code.";
 }
 
-TEST(Error, createStringErrorV) {
-  static llvm::StringRef Bar("bar");
-  static const std::error_code EC = errc::invalid_argument;
-  std::string Msg;
-  raw_string_ostream S(Msg);
-  logAllUnhandledErrors(createStringErrorV(EC, "foo{0}{1}{2:x}", Bar, 1, 0xff),
-                        S);
-  EXPECT_EQ(S.str(), "foobar10xff\n")
-      << "Unexpected createStringErrorV() log result";
-
-  S.flush();
-  Msg.clear();
-  auto Res = errorToErrorCode(createStringErrorV(EC, "foo{0}", Bar));
-  EXPECT_EQ(Res, EC)
-      << "Failed to convert createStringErrorV() result to error_code.";
-}
-
 // Test that the ExitOnError utility works as expected.
 TEST(ErrorDeathTest, ExitOnError) {
   ExitOnError ExitOnErr;


        


More information about the llvm-branch-commits mailing list