diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 05:26:12 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 05:26:12 +0000 |
commit | e00fec8fe470a800423688b448434f3b2340d038 (patch) | |
tree | 1c664e60cef7d410e1fe49564fb29787d920e40e /llvm | |
parent | 92512e89a2a653eb5b9fb5485c8681f225ebaf1e (diff) | |
download | bcm5719-llvm-e00fec8fe470a800423688b448434f3b2340d038.tar.gz bcm5719-llvm-e00fec8fe470a800423688b448434f3b2340d038.zip |
Use an enum class.
llvm-svn: 210078
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Object/Error.h | 21 | ||||
-rw-r--r-- | llvm/lib/Object/Error.cpp | 8 |
2 files changed, 10 insertions, 19 deletions
diff --git a/llvm/include/llvm/Object/Error.h b/llvm/include/llvm/Object/Error.h index 779c747461a..5359f498b2e 100644 --- a/llvm/include/llvm/Object/Error.h +++ b/llvm/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<object::object_error> : std::true_type {}; -template <> -struct is_error_code_enum<object::object_error::Impl> : std::true_type {}; - } // end namespace llvm. #endif diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index 6f72849ae27..f1d0f0184d2 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/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<object_error::Impl>(ev); +std::string _object_error_category::message(int EV) const { + object_error E = static_cast<object_error>(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<object_error>(EV) == object_error::success) return error_condition(); return errc::invalid_argument; } |