From: Rafael Espindola Date: Tue, 3 Jun 2014 05:12:33 +0000 (+0000) Subject: Use an enum class. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92512e89a2a653eb5b9fb5485c8681f225ebaf1e;p=platform%2Fupstream%2Fllvm.git Use an enum class. Might also fix the windows build. llvm-svn: 210077 --- diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 8457678..b08084c 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -22,8 +22,7 @@ namespace llvm { const error_category &instrprof_category(); -struct instrprof_error { - enum ErrorType { +enum class instrprof_error { success = 0, eof, bad_magic, @@ -37,11 +36,6 @@ struct instrprof_error { hash_mismatch, count_mismatch, counter_overflow - }; - ErrorType V; - - instrprof_error(ErrorType V) : V(V) {} - operator ErrorType() const { return V; } }; inline error_code make_error_code(instrprof_error E) { @@ -49,8 +43,6 @@ inline error_code make_error_code(instrprof_error E) { } template <> struct is_error_code_enum : std::true_type {}; -template <> struct is_error_code_enum - : std::true_type {}; } // end namespace llvm diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 60a8efb..a658313 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -21,7 +21,7 @@ namespace { class InstrProfErrorCategoryType : public error_category { const char *name() const 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"; @@ -53,7 +53,7 @@ class InstrProfErrorCategoryType : public error_category { llvm_unreachable("A value of instrprof_error has no message."); } error_condition default_error_condition(int EV) const override { - if (EV == instrprof_error::success) + if (static_cast(EV) == instrprof_error::success) return error_condition(); return errc::invalid_argument; }