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