2013-04-04 02:31:38 +08:00
|
|
|
//===- Error.h - system_error extensions for llvm-readobj -------*- 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 llvm-readobj tool.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_READOBJ_ERROR_H
|
|
|
|
#define LLVM_READOBJ_ERROR_H
|
|
|
|
|
2014-06-13 01:38:55 +08:00
|
|
|
#include <system_error>
|
2013-04-04 02:31:38 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2014-06-12 09:45:43 +08:00
|
|
|
const std::error_category &readobj_category();
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2014-06-11 09:22:20 +08:00
|
|
|
enum class readobj_error {
|
|
|
|
success = 0,
|
|
|
|
file_not_found,
|
|
|
|
unsupported_file_format,
|
|
|
|
unrecognized_file_format,
|
|
|
|
unsupported_obj_file_format,
|
|
|
|
unknown_symbol
|
2013-04-04 02:31:38 +08:00
|
|
|
};
|
|
|
|
|
2014-06-13 09:25:41 +08:00
|
|
|
inline std::error_code make_error_code(readobj_error e) {
|
|
|
|
return std::error_code(static_cast<int>(e), readobj_category());
|
2013-04-04 02:31:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
2014-06-12 03:05:50 +08:00
|
|
|
namespace std {
|
|
|
|
template <> struct is_error_code_enum<llvm::readobj_error> : std::true_type {};
|
|
|
|
}
|
|
|
|
|
2013-04-04 02:31:38 +08:00
|
|
|
#endif
|