[llvm] [cmake] Add possibility to use ChooseMSVCCRT.cmake when include LLVM library
[llvm-core.git] / include / llvm / DebugInfo / MSF / MSFError.h
blobfbc4e6928536f80105210df47e2fa89e311e1a31
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_MSF_MSFERROR_H
10 #define LLVM_DEBUGINFO_MSF_MSFERROR_H
12 #include "llvm/Support/Error.h"
14 #include <string>
16 namespace llvm {
17 namespace msf {
18 enum class msf_error_code {
19 unspecified = 1,
20 insufficient_buffer,
21 not_writable,
22 no_stream,
23 invalid_format,
24 block_in_use
26 } // namespace msf
27 } // namespace llvm
29 namespace std {
30 template <>
31 struct is_error_code_enum<llvm::msf::msf_error_code> : std::true_type {};
32 } // namespace std
34 namespace llvm {
35 namespace msf {
36 const std::error_category &MSFErrCategory();
38 inline std::error_code make_error_code(msf_error_code E) {
39 return std::error_code(static_cast<int>(E), MSFErrCategory());
42 /// Base class for errors originating when parsing raw PDB files
43 class MSFError : public ErrorInfo<MSFError, StringError> {
44 public:
45 using ErrorInfo<MSFError, StringError>::ErrorInfo; // inherit constructors
46 MSFError(const Twine &S) : ErrorInfo(S, msf_error_code::unspecified) {}
47 static char ID;
49 } // namespace msf
50 } // namespace llvm
52 #endif // LLVM_DEBUGINFO_MSF_MSFERROR_H