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