diff options
Diffstat (limited to 'tools/obj2yaml/Error.cpp')
-rw-r--r-- | tools/obj2yaml/Error.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/obj2yaml/Error.cpp b/tools/obj2yaml/Error.cpp index abef8af58cbfe..9d1af680a7399 100644 --- a/tools/obj2yaml/Error.cpp +++ b/tools/obj2yaml/Error.cpp @@ -13,6 +13,9 @@ using namespace llvm; namespace { +// FIXME: This class is only here to support the transition to llvm::Error. It +// will be removed once this transition is complete. Clients should prefer to +// deal with the Error value directly, rather than converting to error_code. class _obj2yaml_error_category : public std::error_category { public: const char *name() const LLVM_NOEXCEPT override; @@ -34,14 +37,26 @@ std::string _obj2yaml_error_category::message(int ev) const { return "Unrecognized file type."; case obj2yaml_error::unsupported_obj_file_format: return "Unsupported object file format."; + case obj2yaml_error::not_implemented: + return "Feature not yet implemented."; } llvm_unreachable("An enumerator of obj2yaml_error does not have a message " "defined."); } namespace llvm { - const std::error_category &obj2yaml_category() { + +const std::error_category &obj2yaml_category() { static _obj2yaml_error_category o; return o; } + +char Obj2YamlError::ID = 0; + +void Obj2YamlError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; } + +std::error_code Obj2YamlError::convertToErrorCode() const { + return std::error_code(static_cast<int>(Code), obj2yaml_category()); +} + } // namespace llvm |