Error.h revision 283631
1258945Sroberto//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
2280849Scy//
3258945Sroberto//                     The LLVM Compiler Infrastructure
4258945Sroberto//
5258945Sroberto// This file is distributed under the University of Illinois Open Source
6258945Sroberto// License. See LICENSE.TXT for details.
7258945Sroberto//
8258945Sroberto//===----------------------------------------------------------------------===//
9258945Sroberto//
10258945Sroberto// This declares a new error_category for the llvm-cxxdump tool.
11258945Sroberto//
12258945Sroberto//===----------------------------------------------------------------------===//
13258945Sroberto
14258945Sroberto#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
15258945Sroberto#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
16258945Sroberto
17258945Sroberto#include <system_error>
18280849Scy
19258945Srobertonamespace llvm {
20258945Srobertoconst std::error_category &cxxdump_category();
21258945Sroberto
22258945Srobertoenum class cxxdump_error {
23258945Sroberto  success = 0,
24258945Sroberto  file_not_found,
25258945Sroberto  unrecognized_file_format,
26258945Sroberto};
27258945Sroberto
28258945Srobertoinline std::error_code make_error_code(cxxdump_error e) {
29258945Sroberto  return std::error_code(static_cast<int>(e), cxxdump_category());
30258945Sroberto}
31258945Sroberto
32258945Sroberto} // namespace llvm
33258945Sroberto
34258945Srobertonamespace std {
35258945Srobertotemplate <>
36258945Srobertostruct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
37258945Sroberto}
38258945Sroberto
39258945Sroberto#endif
40258945Sroberto