blob: 7caf6d6447c9e204b3f8860e37b60916db14bbe6 [file] [log] [blame]
David Majnemerf45bbd02015-03-15 01:30:58 +00001//===- Error.h - system_error extensions for llvm-cxxdump -------*- 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-cxxdump tool.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
15#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
16
17#include <system_error>
18
19namespace llvm {
20const std::error_category &cxxdump_category();
21
22enum class cxxdump_error {
23 success = 0,
24 file_not_found,
25 unrecognized_file_format,
26};
27
28inline std::error_code make_error_code(cxxdump_error e) {
29 return std::error_code(static_cast<int>(e), cxxdump_category());
30}
31
32} // namespace llvm
33
34namespace std {
35template <>
36struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
37}
38
39#endif