summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Error.cpp
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
commite107ade3f9ddf6fd4ee7cb64fbf8d56315e29e1f (patch)
tree39fc2016d5f40e1b419541a3fdae0d4e10a9c0ae /llvm/lib/Object/Error.cpp
parentfc3f61fcf0f347c89fb6103249150f6287fd7579 (diff)
downloadbcm5719-llvm-e107ade3f9ddf6fd4ee7cb64fbf8d56315e29e1f.tar.gz
bcm5719-llvm-e107ade3f9ddf6fd4ee7cb64fbf8d56315e29e1f.zip
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. llvm-svn: 184186
Diffstat (limited to 'llvm/lib/Object/Error.cpp')
-rw-r--r--llvm/lib/Object/Error.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp
index 25946257ab5..7005a72d68b 100644
--- a/llvm/lib/Object/Error.cpp
+++ b/llvm/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<object_error::Impl>(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 {
OpenPOWER on IntegriCloud