llvm.org GIT mirror llvm / e869d88
Use an enum class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210623 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
2 changed file(s) with 13 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
2828 return "llvm.readobj";
2929 }
3030
31 std::string _readobj_error_category::message(int ev) const {
32 switch (ev) {
31 std::string _readobj_error_category::message(int EV) const {
32 switch (static_cast(EV)) {
3333 case readobj_error::success: return "Success";
3434 case readobj_error::file_not_found:
3535 return "No such file.";
4141 return "Unsupported object file format.";
4242 case readobj_error::unknown_symbol:
4343 return "Unknown symbol.";
44 default:
45 llvm_unreachable("An enumerator of readobj_error does not have a message "
46 "defined.");
4744 }
45 llvm_unreachable("An enumerator of readobj_error does not have a message "
46 "defined.");
4847 }
4948
50 error_condition _readobj_error_category::default_error_condition(int ev) const {
51 if (ev == readobj_error::success)
49 error_condition _readobj_error_category::default_error_condition(int EV) const {
50 if (static_cast(EV) == readobj_error::success)
5251 return error_condition();
5352 return errc::invalid_argument;
5453 }
1919
2020 const error_category &readobj_category();
2121
22 struct readobj_error {
23 enum _ {
24 success = 0,
25 file_not_found,
26 unsupported_file_format,
27 unrecognized_file_format,
28 unsupported_obj_file_format,
29 unknown_symbol
30 };
31 _ v_;
32
33 readobj_error(_ v) : v_(v) {}
34 explicit readobj_error(int v) : v_(_(v)) {}
35 operator int() const {return v_;}
22 enum class readobj_error {
23 success = 0,
24 file_not_found,
25 unsupported_file_format,
26 unrecognized_file_format,
27 unsupported_obj_file_format,
28 unknown_symbol
3629 };
3730
3831 inline error_code make_error_code(readobj_error e) {
4033 }
4134
4235 template <> struct is_error_code_enum : std::true_type { };
43 template <> struct is_error_code_enum : std::true_type { };
4436
4537 } // namespace llvm
4638