blob: b4ffb82efcd688433bf2f2717f392855936d8c41 [file] [log] [blame]
Eric Christopher9cad53c2013-04-03 18:31:38 +00001//===- Error.h - system_error extensions for llvm-readobj -------*- 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 llvm-readobj tool.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_READOBJ_ERROR_H
15#define LLVM_READOBJ_ERROR_H
16
17#include "llvm/Support/system_error.h"
18
19namespace llvm {
20
Rafael Espindola25188c92014-06-12 01:45:43 +000021const std::error_category &readobj_category();
Eric Christopher9cad53c2013-04-03 18:31:38 +000022
Rafael Espindola933c9502014-06-11 01:22:20 +000023enum class readobj_error {
24 success = 0,
25 file_not_found,
26 unsupported_file_format,
27 unrecognized_file_format,
28 unsupported_obj_file_format,
29 unknown_symbol
Eric Christopher9cad53c2013-04-03 18:31:38 +000030};
31
32inline error_code make_error_code(readobj_error e) {
33 return error_code(static_cast<int>(e), readobj_category());
34}
35
Eric Christopher9cad53c2013-04-03 18:31:38 +000036} // namespace llvm
37
Rafael Espindola5c4f8292014-06-11 19:05:50 +000038namespace std {
39template <> struct is_error_code_enum<llvm::readobj_error> : std::true_type {};
40}
41
Eric Christopher9cad53c2013-04-03 18:31:38 +000042#endif