return std::error_code(static_cast<int>(e), LinkerScriptReaderCategory());
}
-/// \brief Errors returned by Reader.
-const std::error_category &ReaderErrorCategory();
-
-enum class ReaderError {
- success = 0,
- unknown_file_format = 1
-};
-
-inline std::error_code make_error_code(ReaderError e) {
- return std::error_code(static_cast<int>(e), ReaderErrorCategory());
-}
-
-
/// Creates an error_code object that has associated with it an arbitrary
/// error messsage. The value() of the error_code will always be non-zero
/// but its value is meaningless. The messsage() will be (a copy of) the
template <> struct is_error_code_enum<lld::YamlReaderError> : std::true_type {};
template <>
struct is_error_code_enum<lld::LinkerScriptReaderError> : std::true_type {};
-template <> struct is_error_code_enum<lld::ReaderError> : std::true_type {};
}
#endif
return o;
}
-class _ReaderErrorCategory : public std::error_category {
-public:
- const char *name() const LLVM_NOEXCEPT override {
- return "lld.inputGraph.parse";
- }
-
- std::string message(int ev) const override {
- switch (static_cast<ReaderError>(ev)) {
- case ReaderError::success:
- return "Success";
- case ReaderError::unknown_file_format:
- return "File format for the input file is not recognized by this flavor";
- }
- llvm_unreachable("An enumerator of ReaderError does not have a "
- "message defined.");
- }
-};
-
-const std::error_category &lld::ReaderErrorCategory() {
- static _ReaderErrorCategory i;
- return i;
-}
-
-
-
namespace lld {
-
/// Temporary class to enable make_dynamic_error_code() until
/// llvm::ErrorOr<> is updated to work with error encapsulations
/// other than error_code.
case llvm::sys::fs::file_magic::unknown:
return std::error_code();
default:
- break;
+ return make_dynamic_error_code(StringRef("unknown type of object file"));
}
- return make_error_code(ReaderError::unknown_file_format);
}
// Parses an argument of --defsym=<sym>=<number>