[llvm] 0a69707 - Revert "[Support] Move StringExtras.h include from Error.h to Error.cpp"
Elliot Goodrich via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 13 01:07:28 PDT 2023
Author: Elliot Goodrich
Date: 2023-07-13T09:07:14+01:00
New Revision: 0a69707d3ce0bf658c95234f18d4de63325e3c90
URL: https://github.com/llvm/llvm-project/commit/0a69707d3ce0bf658c95234f18d4de63325e3c90
DIFF: https://github.com/llvm/llvm-project/commit/0a69707d3ce0bf658c95234f18d4de63325e3c90.diff
LOG: Revert "[Support] Move StringExtras.h include from Error.h to Error.cpp"
This reverts commit 5be8c89ed6d959d57ae21c168dc4215ce0d05553.
Added:
Modified:
llvm/include/llvm/Support/Error.h
llvm/lib/Support/Error.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 2292770a97c4b4..0f1b6321762d0c 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -14,6 +14,8 @@
#define LLVM_SUPPORT_ERROR_H
#include "llvm-c/Error.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/abi-breaking.h"
#include "llvm/Support/AlignOf.h"
@@ -1023,7 +1025,13 @@ void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner = {});
/// Write all error messages (if any) in E to a string. The newline character
/// is used to separate error messages.
-std::string toString(Error E);
+inline std::string toString(Error E) {
+ SmallVector<std::string, 2> Errors;
+ handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
+ Errors.push_back(EI.message());
+ });
+ return join(Errors.begin(), Errors.end(), "\n");
+}
/// Consume a Error without doing anything. This method should be used
/// only where an error can be considered a reasonable and expected return
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index 21d591530b41a1..b339b708d90686 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -7,8 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/Error.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ErrorHandling.h"
#include <system_error>
@@ -72,15 +70,6 @@ void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) {
});
}
-/// Write all error messages (if any) in E to a string. The newline character
-/// is used to separate error messages.
-std::string toString(Error E) {
- SmallVector<std::string, 2> Errors;
- handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
- Errors.push_back(EI.message());
- });
- return join(Errors.begin(), Errors.end(), "\n");
-}
std::error_code ErrorList::convertToErrorCode() const {
return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
More information about the llvm-commits
mailing list