Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[Support] Introduce formatv variant of createStringError" #82126

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

bulbazord
Copy link
Member

Reverts #80493

This increased clang compile times by 0.5%. I'll figure out a less expensive way to achieve this.

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 17, 2024

@llvm/pr-subscribers-llvm-support

Author: Alex Langford (bulbazord)

Changes

Reverts llvm/llvm-project#80493

This increased clang compile times by 0.5%. I'll figure out a less expensive way to achieve this.


Full diff: https://github.com/llvm/llvm-project/pull/82126.diff

2 Files Affected:

  • (modified) llvm/include/llvm/Support/Error.h (-10)
  • (modified) llvm/unittests/Support/ErrorTest.cpp (-17)
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;

@bulbazord bulbazord merged commit 164055f into main Feb 17, 2024
6 checks passed
@bulbazord bulbazord deleted the revert-80493-create-string-error-v branch February 17, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants