Remove system_error.h.
[oota-llvm.git] / tools / llvm-readobj / Error.h
1 //===- Error.h - system_error extensions for llvm-readobj -------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This declares a new error_category for the llvm-readobj tool.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_READOBJ_ERROR_H
15 #define LLVM_READOBJ_ERROR_H
16
17 #include <system_error>
18
19 namespace llvm {
20 using std::error_code;
21 const std::error_category &readobj_category();
22
23 enum class readobj_error {
24   success = 0,
25   file_not_found,
26   unsupported_file_format,
27   unrecognized_file_format,
28   unsupported_obj_file_format,
29   unknown_symbol
30 };
31
32 inline error_code make_error_code(readobj_error e) {
33   return error_code(static_cast<int>(e), readobj_category());
34 }
35
36 } // namespace llvm
37
38 namespace std {
39 template <> struct is_error_code_enum<llvm::readobj_error> : std::true_type {};
40 }
41
42 #endif