From: Rafael Espindola Date: Tue, 3 Jun 2014 05:26:12 +0000 (+0000) Subject: Use an enum class. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b468431b373a01a83847d2c0476a780128c12b93;p=oota-llvm.git Use an enum class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210078 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Object/Error.h b/include/llvm/Object/Error.h index 779c747461a..5359f498b2e 100644 --- a/include/llvm/Object/Error.h +++ b/include/llvm/Object/Error.h @@ -21,18 +21,12 @@ namespace object { const error_category &object_category(); -struct object_error { - enum Impl { - success = 0, - arch_not_found, - invalid_file_type, - parse_failed, - unexpected_eof - }; - Impl V; - - object_error(Impl V) : V(V) {} - operator Impl() const { return V; } +enum class object_error { + success = 0, + arch_not_found, + invalid_file_type, + parse_failed, + unexpected_eof }; inline error_code make_error_code(object_error e) { @@ -43,9 +37,6 @@ inline error_code make_error_code(object_error e) { template <> struct is_error_code_enum : std::true_type {}; -template <> -struct is_error_code_enum : std::true_type {}; - } // end namespace llvm. #endif diff --git a/lib/Object/Error.cpp b/lib/Object/Error.cpp index 6f72849ae27..f1d0f0184d2 100644 --- a/lib/Object/Error.cpp +++ b/lib/Object/Error.cpp @@ -30,8 +30,8 @@ const char *_object_error_category::name() const { return "llvm.object"; } -std::string _object_error_category::message(int ev) const { - object_error::Impl E = static_cast(ev); +std::string _object_error_category::message(int EV) const { + object_error E = static_cast(EV); switch (E) { case object_error::success: return "Success"; case object_error::arch_not_found: @@ -47,8 +47,8 @@ std::string _object_error_category::message(int ev) const { "defined."); } -error_condition _object_error_category::default_error_condition(int ev) const { - if (ev == object_error::success) +error_condition _object_error_category::default_error_condition(int EV) const { + if (static_cast(EV) == object_error::success) return error_condition(); return errc::invalid_argument; }