summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-03 05:26:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-03 05:26:12 +0000
commitb468431b373a01a83847d2c0476a780128c12b93 (patch)
treee15d72df4d7029d0e4972cd33cd35ba72baffa5c
parent18b40871942620776499e77811c84a66627c8b1f (diff)
downloadllvm-b468431b373a01a83847d2c0476a780128c12b93.tar.gz
llvm-b468431b373a01a83847d2c0476a780128c12b93.tar.bz2
llvm-b468431b373a01a83847d2c0476a780128c12b93.tar.xz
Use an enum class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210078 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Object/Error.h21
-rw-r--r--lib/Object/Error.cpp8
2 files changed, 10 insertions, 19 deletions
diff --git a/include/llvm/Object/Error.h b/include/llvm/Object/Error.h
index 779c747461..5359f498b2 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<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/lib/Object/Error.cpp b/lib/Object/Error.cpp
index 6f72849ae2..f1d0f0184d 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<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;
}