Error.h revision 360660
138096Speter//===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===// 264567Sgshapiro// 338096Speter// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 480029Sobrien// See https://llvm.org/LICENSE.txt for license information. 580029Sobrien// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 638096Speter// 738096Speter//===----------------------------------------------------------------------===// 890798Sgshapiro// 974816Sru// This declares a new error_category for the llvm-cxxdump tool. 1038096Speter// 1190798Sgshapiro//===----------------------------------------------------------------------===// 1280029Sobrien 1380029Sobrien#ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 14201390Sed#define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 15201390Sed 16147225Sdes#include <system_error> 17147225Sdes 1890798Sgshapironamespace llvm { 19147225Sdesconst std::error_category &cxxdump_category(); 20147225Sdes 2164567Sgshapiroenum class cxxdump_error { 22147225Sdes success = 0, 23147225Sdes file_not_found, 2464567Sgshapiro unrecognized_file_format, 2590798Sgshapiro}; 2690798Sgshapiro 2764567Sgshapiroinline std::error_code make_error_code(cxxdump_error e) { 2890798Sgshapiro return std::error_code(static_cast<int>(e), cxxdump_category()); 2990798Sgshapiro} 3090798Sgshapiro 3165970Sgshapiro} // namespace llvm 3280029Sobrien 3365970Sgshapironamespace std { 3480029Sobrientemplate <> 3580029Sobrienstruct is_error_code_enum<llvm::cxxdump_error> : std::true_type {}; 3665970Sgshapiro} 3790798Sgshapiro 3890798Sgshapiro#endif 3990798Sgshapiro