#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ManagedStatic.h"
using namespace llvm;
namespace {
-class InstrProfErrorCategoryType : public error_category {
- const char *name() const override { return "llvm.instrprof"; }
+class InstrProfErrorCategoryType : public std::error_category {
+ const char *name() const LLVM_NOEXCEPT override { return "llvm.instrprof"; }
std::string message(int IE) const override {
- instrprof_error::ErrorType E = static_cast<instrprof_error::ErrorType>(IE);
+ instrprof_error E = static_cast<instrprof_error>(IE);
switch (E) {
case instrprof_error::success:
return "Success";
}
llvm_unreachable("A value of instrprof_error has no message.");
}
- error_condition default_error_condition(int EV) const {
- if (EV == instrprof_error::success)
- return errc::success;
- return errc::invalid_argument;
- }
};
}
-const error_category &llvm::instrprof_category() {
- static InstrProfErrorCategoryType C;
- return C;
+static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
+
+const std::error_category &llvm::instrprof_category() {
+ return *ErrorCategory;
}