Remove object_error::success and use std::error_code() instead
[oota-llvm.git] / include / llvm / Object / Error.h
1 //===- Error.h - system_error extensions for Object -------------*- 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 Object library.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_OBJECT_ERROR_H
15 #define LLVM_OBJECT_ERROR_H
16
17 #include <system_error>
18
19 namespace llvm {
20 namespace object {
21
22 const std::error_category &object_category();
23
24 enum class object_error {
25   // Error code 0 is absent. Use std::error_code() instead.
26   arch_not_found = 1,
27   invalid_file_type,
28   parse_failed,
29   unexpected_eof,
30   bitcode_section_not_found,
31   macho_small_load_command,
32   macho_load_segment_too_many_sections,
33   macho_load_segment_too_small,
34 };
35
36 inline std::error_code make_error_code(object_error e) {
37   return std::error_code(static_cast<int>(e), object_category());
38 }
39
40 } // end namespace object.
41
42 } // end namespace llvm.
43
44 namespace std {
45 template <>
46 struct is_error_code_enum<llvm::object::object_error> : std::true_type {};
47 }
48
49 #endif