Error.h revision 283625
1283625Sdim//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
2283625Sdim//
3283625Sdim//                     The LLVM Compiler Infrastructure
4283625Sdim//
5283625Sdim// This file is distributed under the University of Illinois Open Source
6283625Sdim// License. See LICENSE.TXT for details.
7283625Sdim//
8283625Sdim//===----------------------------------------------------------------------===//
9283625Sdim//
10283625Sdim// This declares a new error_category for the llvm-cxxdump tool.
11283625Sdim//
12283625Sdim//===----------------------------------------------------------------------===//
13283625Sdim
14283625Sdim#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
15283625Sdim#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
16283625Sdim
17283625Sdim#include <system_error>
18283625Sdim
19283625Sdimnamespace llvm {
20283625Sdimconst std::error_category &cxxdump_category();
21283625Sdim
22283625Sdimenum class cxxdump_error {
23283625Sdim  success = 0,
24283625Sdim  file_not_found,
25283625Sdim  unrecognized_file_format,
26283625Sdim};
27283625Sdim
28283625Sdiminline std::error_code make_error_code(cxxdump_error e) {
29283625Sdim  return std::error_code(static_cast<int>(e), cxxdump_category());
30283625Sdim}
31283625Sdim
32283625Sdim} // namespace llvm
33283625Sdim
34283625Sdimnamespace std {
35283625Sdimtemplate <>
36283625Sdimstruct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
37283625Sdim}
38283625Sdim
39283625Sdim#endif
40