2015-03-15 09:30:58 +08:00
|
|
|
//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
|
2014-07-25 07:14:40 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-07-25 07:14:40 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2015-03-15 09:30:58 +08:00
|
|
|
// This declares a new error_category for the llvm-cxxdump tool.
|
2014-07-25 07:14:40 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-15 09:30:58 +08:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
|
|
|
|
#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
|
2014-07-25 07:14:40 +08:00
|
|
|
|
|
|
|
#include <system_error>
|
|
|
|
|
|
|
|
namespace llvm {
|
2015-03-15 09:30:58 +08:00
|
|
|
const std::error_category &cxxdump_category();
|
2014-07-25 07:14:40 +08:00
|
|
|
|
2015-03-15 09:30:58 +08:00
|
|
|
enum class cxxdump_error {
|
2014-07-25 07:14:40 +08:00
|
|
|
success = 0,
|
|
|
|
file_not_found,
|
|
|
|
unrecognized_file_format,
|
|
|
|
};
|
|
|
|
|
2015-03-15 09:30:58 +08:00
|
|
|
inline std::error_code make_error_code(cxxdump_error e) {
|
|
|
|
return std::error_code(static_cast<int>(e), cxxdump_category());
|
2014-07-25 07:14:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
template <>
|
2015-03-15 09:30:58 +08:00
|
|
|
struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
|
2014-07-25 07:14:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|