summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-18 13:30:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-18 13:30:31 +0000
commit79ac9c8402d4113d42ff2d713c7acdfa800d2397 (patch)
tree9e2c7d7c931ddf6241f21074bb67c202a8a3961e /include
parentbeb920fce6ccc89b4735f280f94cb8c227f4ef5e (diff)
downloadllvm-79ac9c8402d4113d42ff2d713c7acdfa800d2397.tar.gz
llvm-79ac9c8402d4113d42ff2d713c7acdfa800d2397.tar.bz2
llvm-79ac9c8402d4113d42ff2d713c7acdfa800d2397.tar.xz
Don't convert object_error's enum to and from int.
This allows the compiler to see the enum and warn about it. While in here, fix a switch to not use a default and fix style violations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/Error.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/llvm/Object/Error.h b/include/llvm/Object/Error.h
index fbaf71c17b..32b834f215 100644
--- a/include/llvm/Object/Error.h
+++ b/include/llvm/Object/Error.h
@@ -22,17 +22,16 @@ namespace object {
const error_category &object_category();
struct object_error {
-enum _ {
- success = 0,
- invalid_file_type,
- parse_failed,
- unexpected_eof
-};
- _ v_;
-
- object_error(_ v) : v_(v) {}
- explicit object_error(int v) : v_(_(v)) {}
- operator int() const {return v_;}
+ enum Impl {
+ success = 0,
+ invalid_file_type,
+ parse_failed,
+ unexpected_eof
+ };
+ Impl V;
+
+ object_error(Impl V) : V(V) {}
+ operator Impl() const { return V; }
};
inline error_code make_error_code(object_error e) {
@@ -43,7 +42,8 @@ inline error_code make_error_code(object_error e) {
template <> struct is_error_code_enum<object::object_error> : true_type { };
-template <> struct is_error_code_enum<object::object_error::_> : true_type { };
+template <> struct is_error_code_enum<object::object_error::Impl> : true_type {
+};
} // end namespace llvm.