2011-06-25 17:42:56 +00:00
|
|
|
//===- Error.h - system_error extensions for Object -------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This declares a new error_category for the Object library.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_OBJECT_ERROR_H
|
|
|
|
#define LLVM_OBJECT_ERROR_H
|
|
|
|
|
2014-06-12 17:38:55 +00:00
|
|
|
#include <system_error>
|
2011-06-25 17:42:56 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace object {
|
|
|
|
|
2014-06-12 01:45:43 +00:00
|
|
|
const std::error_category &object_category();
|
2011-06-25 17:42:56 +00:00
|
|
|
|
2014-06-03 05:26:12 +00:00
|
|
|
enum class object_error {
|
|
|
|
success = 0,
|
|
|
|
arch_not_found,
|
|
|
|
invalid_file_type,
|
|
|
|
parse_failed,
|
2014-09-18 21:28:49 +00:00
|
|
|
unexpected_eof,
|
|
|
|
bitcode_section_not_found,
|
2011-06-25 17:42:56 +00:00
|
|
|
};
|
|
|
|
|
2014-06-12 21:46:39 +00:00
|
|
|
inline std::error_code make_error_code(object_error e) {
|
|
|
|
return std::error_code(static_cast<int>(e), object_category());
|
2011-06-25 17:42:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace object.
|
|
|
|
|
|
|
|
} // end namespace llvm.
|
|
|
|
|
2014-06-11 19:05:50 +00:00
|
|
|
namespace std {
|
|
|
|
template <>
|
|
|
|
struct is_error_code_enum<llvm::object::object_error> : std::true_type {};
|
|
|
|
}
|
|
|
|
|
2011-06-25 17:42:56 +00:00
|
|
|
#endif
|