1 //===- MSFError.h - Error extensions for MSF Files --------------*- 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 #ifndef LLVM_DEBUGINFO_MSF_MSFERROR_H 10 #define LLVM_DEBUGINFO_MSF_MSFERROR_H 11 12 #include "llvm/Support/Error.h" 13 14 #include <string> 15 16 namespace llvm { 17 namespace msf { 18 enum class msf_error_code { 19 unspecified = 1, 20 insufficient_buffer, 21 size_overflow, 22 not_writable, 23 no_stream, 24 invalid_format, 25 block_in_use 26 }; 27 } // namespace msf 28 } // namespace llvm 29 30 namespace std { 31 template <> 32 struct is_error_code_enum<llvm::msf::msf_error_code> : std::true_type {}; 33 } // namespace std 34 35 namespace llvm { 36 namespace msf { 37 const std::error_category &MSFErrCategory(); 38 39 inline std::error_code make_error_code(msf_error_code E) { 40 return std::error_code(static_cast<int>(E), MSFErrCategory()); 41 } 42 43 /// Base class for errors originating when parsing raw PDB files 44 class MSFError : public ErrorInfo<MSFError, StringError> { 45 public: 46 using ErrorInfo<MSFError, StringError>::ErrorInfo; // inherit constructors 47 MSFError(const Twine &S) : ErrorInfo(S, msf_error_code::unspecified) {} 48 static char ID; 49 }; 50 } // namespace msf 51 } // namespace llvm 52 53 #endif // LLVM_DEBUGINFO_MSF_MSFERROR_H 54