#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ManagedStatic.h"
using namespace llvm;
case instrprof_error::eof:
return "End of File";
case instrprof_error::bad_magic:
- return "Invalid file format (bad magic)";
+ return "Invalid profile data (bad magic)";
case instrprof_error::bad_header:
- return "Invalid header";
+ return "Invalid profile data (file header is corrupt)";
case instrprof_error::unsupported_version:
- return "Unsupported format version";
+ return "Unsupported profiling format version";
case instrprof_error::unsupported_hash_type:
- return "Unsupported hash function";
+ return "Unsupported profiling hash";
case instrprof_error::too_large:
return "Too much profile data";
case instrprof_error::truncated:
}
llvm_unreachable("A value of instrprof_error has no message.");
}
- std::error_condition
- default_error_condition(int EV) const LLVM_NOEXCEPT override {
- if (static_cast<instrprof_error>(EV) == instrprof_error::success)
- return std::error_condition();
- return std::errc::invalid_argument;
- }
};
}
+static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
+
const std::error_category &llvm::instrprof_category() {
- static InstrProfErrorCategoryType C;
- return C;
+ return *ErrorCategory;
}