Skip to content

Commit

Permalink
Revert "[Support] Introduce formatv variant of createStringError (#80493
Browse files Browse the repository at this point in the history
)"

This reverts commit 4bb0ca6.
  • Loading branch information
bulbazord committed Feb 17, 2024
1 parent 21ddd7f commit 784cd68
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
10 changes: 0 additions & 10 deletions llvm/include/llvm/Support/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions llvm/unittests/Support/ErrorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 784cd68

Please sign in to comment.