aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Error.cpp
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2022-06-29 14:29:33 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2022-07-10 09:15:08 +0200
commite6f1f062457c928c18a88c612f39d9e168f65a85 (patch)
treeb90f5190cbeabf748e143602c280c37567d78850 /llvm/lib/Support/Error.cpp
parentda6a14b91ad999327b41a9040577273591e4ad1d (diff)
downloadllvm-e6f1f062457c928c18a88c612f39d9e168f65a85.zip
llvm-e6f1f062457c928c18a88c612f39d9e168f65a85.tar.gz
llvm-e6f1f062457c928c18a88c612f39d9e168f65a85.tar.bz2
ManagedStatic: remove many straightforward uses in llvm
Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases, moving the static variable directly into the only function that uses it. Differential Revision: https://reviews.llvm.org/D129120
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r--llvm/lib/Support/Error.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index 8bfc8ee..fbe86f2 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -9,7 +9,6 @@
#include "llvm/Support/Error.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
#include <system_error>
using namespace llvm;
@@ -46,7 +45,10 @@ namespace {
}
-static ManagedStatic<ErrorErrorCategory> ErrorErrorCat;
+ErrorErrorCategory &getErrorErrorCat() {
+ static ErrorErrorCategory ErrorErrorCat;
+ return ErrorErrorCat;
+}
namespace llvm {
@@ -71,19 +73,19 @@ void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) {
std::error_code ErrorList::convertToErrorCode() const {
return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
- *ErrorErrorCat);
+ getErrorErrorCat());
}
std::error_code inconvertibleErrorCode() {
return std::error_code(static_cast<int>(ErrorErrorCode::InconvertibleError),
- *ErrorErrorCat);
+ getErrorErrorCat());
}
std::error_code FileError::convertToErrorCode() const {
std::error_code NestedEC = Err->convertToErrorCode();
if (NestedEC == inconvertibleErrorCode())
return std::error_code(static_cast<int>(ErrorErrorCode::FileError),
- *ErrorErrorCat);
+ getErrorErrorCat());
return NestedEC;
}