1283625Sdim//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
2283625Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6283625Sdim//
7283625Sdim//===----------------------------------------------------------------------===//
8283625Sdim//
9283625Sdim// This declares a new error_category for the llvm-cxxdump tool.
10283625Sdim//
11283625Sdim//===----------------------------------------------------------------------===//
12283625Sdim
13283625Sdim#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
14283625Sdim#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
15283625Sdim
16283625Sdim#include <system_error>
17283625Sdim
18283625Sdimnamespace llvm {
19283625Sdimconst std::error_category &cxxdump_category();
20283625Sdim
21283625Sdimenum class cxxdump_error {
22283625Sdim  success = 0,
23283625Sdim  file_not_found,
24283625Sdim  unrecognized_file_format,
25283625Sdim};
26283625Sdim
27283625Sdiminline std::error_code make_error_code(cxxdump_error e) {
28283625Sdim  return std::error_code(static_cast<int>(e), cxxdump_category());
29283625Sdim}
30283625Sdim
31283625Sdim} // namespace llvm
32283625Sdim
33283625Sdimnamespace std {
34283625Sdimtemplate <>
35283625Sdimstruct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
36283625Sdim}
37283625Sdim
38283625Sdim#endif
39