1 //===- Error.h - system_error extensions for llvm-readobj -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This declares a new error_category for the llvm-readobj tool.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_READOBJ_ERROR_H
15 #define LLVM_READOBJ_ERROR_H
17 #include "llvm/Support/system_error.h"
21 const error_category &readobj_category();
23 struct readobj_error {
27 unsupported_file_format,
28 unrecognized_file_format,
29 unsupported_obj_file_format,
34 readobj_error(_ v) : v_(v) {}
35 explicit readobj_error(int v) : v_(_(v)) {}
36 operator int() const {return v_;}
39 inline error_code make_error_code(readobj_error e) {
40 return error_code(static_cast<int>(e), readobj_category());
43 template <> struct is_error_code_enum<readobj_error> : true_type { };
44 template <> struct is_error_code_enum<readobj_error::_> : true_type { };