From 79ac9c8402d4113d42ff2d713c7acdfa800d2397 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 18 Jun 2013 13:30:31 +0000 Subject: 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 --- lib/Object/Error.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Object') diff --git a/lib/Object/Error.cpp b/lib/Object/Error.cpp index 2594625..7005a72 100644 --- a/lib/Object/Error.cpp +++ b/lib/Object/Error.cpp @@ -31,7 +31,8 @@ const char *_object_error_category::name() const { } std::string _object_error_category::message(int ev) const { - switch (ev) { + object_error::Impl E = static_cast(ev); + switch (E) { case object_error::success: return "Success"; case object_error::invalid_file_type: return "The file was not recognized as a valid object file"; @@ -39,10 +40,9 @@ std::string _object_error_category::message(int ev) const { return "Invalid data was encountered while parsing the file"; case object_error::unexpected_eof: return "The end of the file was unexpectedly encountered"; - default: - llvm_unreachable("An enumerator of object_error does not have a message " - "defined."); } + llvm_unreachable("An enumerator of object_error does not have a message " + "defined."); } error_condition _object_error_category::default_error_condition(int ev) const { -- cgit v1.1