1249259Sdim//===- Error.h - system_error extensions for llvm-readobj -------*- C++ -*-===// 2249259Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6249259Sdim// 7249259Sdim//===----------------------------------------------------------------------===// 8249259Sdim// 9249259Sdim// This declares a new error_category for the llvm-readobj tool. 10249259Sdim// 11249259Sdim//===----------------------------------------------------------------------===// 12249259Sdim 13280031Sdim#ifndef LLVM_TOOLS_LLVM_READOBJ_ERROR_H 14280031Sdim#define LLVM_TOOLS_LLVM_READOBJ_ERROR_H 15249259Sdim 16276479Sdim#include <system_error> 17249259Sdim 18249259Sdimnamespace llvm { 19276479Sdimconst std::error_category &readobj_category(); 20249259Sdim 21276479Sdimenum class readobj_error { 22276479Sdim success = 0, 23276479Sdim file_not_found, 24276479Sdim unsupported_file_format, 25276479Sdim unrecognized_file_format, 26276479Sdim unsupported_obj_file_format, 27276479Sdim unknown_symbol 28249259Sdim}; 29249259Sdim 30276479Sdiminline std::error_code make_error_code(readobj_error e) { 31276479Sdim return std::error_code(static_cast<int>(e), readobj_category()); 32249259Sdim} 33249259Sdim 34249259Sdim} // namespace llvm 35249259Sdim 36276479Sdimnamespace std { 37276479Sdimtemplate <> struct is_error_code_enum<llvm::readobj_error> : std::true_type {}; 38276479Sdim} 39276479Sdim 40249259Sdim#endif 41