1 //===- Error.h - system_error extensions for Object -------------*- 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 Object library.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_OBJECT_ERROR_H
15 #define LLVM_OBJECT_ERROR_H
17 #include "llvm/Support/system_error.h"
22 const error_category &object_category();
32 object_error(_ v) : v_(v) {}
33 explicit object_error(int v) : v_(_(v)) {}
34 operator int() const {return v_;}
37 } // end namespace object.
39 template <> struct is_error_code_enum<object::object_error> : true_type { };
41 template <> struct is_error_code_enum<object::object_error::_> : true_type { };
43 inline error_code make_error_code(object::object_error e) {
44 return error_code(static_cast<int>(e), object::object_category());
47 } // end namespace llvm.