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
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
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
|