X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FProfileData%2FInstrProf.cpp;h=92822a71402fc8d4eca92d71e3c26fc1aea8d14a;hb=00552e3875ee5f382db6c98286a241a7d0efe1b8;hp=329abf84e6e468490b29c8250ffa0d23a067236c;hpb=c0f3b725555df38fc4d9be6154af95dad83694f8;p=oota-llvm.git diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp index 329abf84e6e..92822a71402 100644 --- a/lib/ProfileData/InstrProf.cpp +++ b/lib/ProfileData/InstrProf.cpp @@ -14,23 +14,28 @@ #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(IE); + instrprof_error E = static_cast(IE); switch (E) { case instrprof_error::success: return "Success"; 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 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 profiling hash"; case instrprof_error::too_large: return "Too much profile data"; case instrprof_error::truncated: @@ -39,18 +44,20 @@ class InstrProfErrorCategoryType : public error_category { return "Malformed profile data"; case instrprof_error::unknown_function: return "No profile data available for function"; + case instrprof_error::hash_mismatch: + return "Function hash mismatch"; + case instrprof_error::count_mismatch: + return "Function count mismatch"; + case instrprof_error::counter_overflow: + return "Counter overflow"; } 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 ErrorCategory; + +const std::error_category &llvm::instrprof_category() { + return *ErrorCategory; }