LLVM API Documentation

Object/Error.h
Go to the documentation of this file.
00001 //===- Error.h - system_error extensions for Object -------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This declares a new error_category for the Object library.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_OBJECT_ERROR_H
00015 #define LLVM_OBJECT_ERROR_H
00016 
00017 #include <system_error>
00018 
00019 namespace llvm {
00020 namespace object {
00021 
00022 const std::error_category &object_category();
00023 
00024 enum class object_error {
00025   success = 0,
00026   arch_not_found,
00027   invalid_file_type,
00028   parse_failed,
00029   unexpected_eof
00030 };
00031 
00032 inline std::error_code make_error_code(object_error e) {
00033   return std::error_code(static_cast<int>(e), object_category());
00034 }
00035 
00036 } // end namespace object.
00037 
00038 } // end namespace llvm.
00039 
00040 namespace std {
00041 template <>
00042 struct is_error_code_enum<llvm::object::object_error> : std::true_type {};
00043 }
00044 
00045 #endif