1 //===- Error.h - system_error extensions for llvm-readobj -------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This declares a new error_category for the llvm-readobj tool.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_TOOLS_LLVM_READOBJ_ERROR_H
14 #define LLVM_TOOLS_LLVM_READOBJ_ERROR_H
16 #include <system_error>
19 const std::error_category
&readobj_category();
21 enum class readobj_error
{
24 unsupported_file_format
,
25 unrecognized_file_format
,
26 unsupported_obj_file_format
,
30 inline std::error_code
make_error_code(readobj_error e
) {
31 return std::error_code(static_cast<int>(e
), readobj_category());
37 template <> struct is_error_code_enum
<llvm::readobj_error
> : std::true_type
{};