1*9880d681SAndroid Build Coastguard Worker //===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This declares a new error_category for the llvm-cxxdump tool. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include <system_error> 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker namespace llvm { 20*9880d681SAndroid Build Coastguard Worker const std::error_category &cxxdump_category(); 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker enum class cxxdump_error { 23*9880d681SAndroid Build Coastguard Worker success = 0, 24*9880d681SAndroid Build Coastguard Worker file_not_found, 25*9880d681SAndroid Build Coastguard Worker unrecognized_file_format, 26*9880d681SAndroid Build Coastguard Worker }; 27*9880d681SAndroid Build Coastguard Worker make_error_code(cxxdump_error e)28*9880d681SAndroid Build Coastguard Workerinline std::error_code make_error_code(cxxdump_error e) { 29*9880d681SAndroid Build Coastguard Worker return std::error_code(static_cast<int>(e), cxxdump_category()); 30*9880d681SAndroid Build Coastguard Worker } 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker } // namespace llvm 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker namespace std { 35*9880d681SAndroid Build Coastguard Worker template <> 36*9880d681SAndroid Build Coastguard Worker struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {}; 37*9880d681SAndroid Build Coastguard Worker } 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker #endif 40