1//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// This declares a new error_category for the llvm-cxxdump tool. 10// 11//===----------------------------------------------------------------------===// 12 13#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 14#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 15 16#include <system_error> 17 18namespace llvm { 19const std::error_category &cxxdump_category(); 20 21enum class cxxdump_error { 22 success = 0, 23 file_not_found, 24 unrecognized_file_format, 25}; 26 27inline std::error_code make_error_code(cxxdump_error e) { 28 return std::error_code(static_cast<int>(e), cxxdump_category()); 29} 30 31} // namespace llvm 32 33namespace std { 34template <> 35struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {}; 36} 37 38#endif 39