2015-03-15 02:30:58 +01:00
|
|
|
//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
|
2014-07-25 01:14:40 +02:00
|
|
|
//
|
2019-01-19 09:50:56 +01: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 01:14:40 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2015-03-15 02:30:58 +01:00
|
|
|
// This declares a new error_category for the llvm-cxxdump tool.
|
2014-07-25 01:14:40 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-15 02:30:58 +01:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
|
|
|
|
#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
|
2014-07-25 01:14:40 +02:00
|
|
|
|
|
|
|
#include <system_error>
|
|
|
|
|
|
|
|
namespace llvm {
|
2015-03-15 02:30:58 +01:00
|
|
|
const std::error_category &cxxdump_category();
|
2014-07-25 01:14:40 +02:00
|
|
|
|
2015-03-15 02:30:58 +01:00
|
|
|
enum class cxxdump_error {
|
2014-07-25 01:14:40 +02:00
|
|
|
success = 0,
|
|
|
|
file_not_found,
|
|
|
|
unrecognized_file_format,
|
|
|
|
};
|
|
|
|
|
2015-03-15 02:30:58 +01:00
|
|
|
inline std::error_code make_error_code(cxxdump_error e) {
|
|
|
|
return std::error_code(static_cast<int>(e), cxxdump_category());
|
2014-07-25 01:14:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
template <>
|
2015-03-15 02:30:58 +01:00
|
|
|
struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
|
2014-07-25 01:14:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|