120
|
1 //===- CodeViewError.h - Error extensions for CodeView ----------*- C++ -*-===//
|
|
2 //
|
147
|
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
|
120
|
6 //
|
|
7 //===----------------------------------------------------------------------===//
|
|
8
|
|
9 #ifndef LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
|
|
10 #define LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
|
|
11
|
|
12 #include "llvm/Support/Error.h"
|
|
13
|
|
14 #include <string>
|
|
15
|
|
16 namespace llvm {
|
|
17 namespace codeview {
|
|
18 enum class cv_error_code {
|
|
19 unspecified = 1,
|
|
20 insufficient_buffer,
|
|
21 operation_unsupported,
|
|
22 corrupt_record,
|
121
|
23 no_records,
|
120
|
24 unknown_member_record,
|
|
25 };
|
147
|
26 } // namespace codeview
|
|
27 } // namespace llvm
|
|
28
|
|
29 namespace std {
|
|
30 template <>
|
|
31 struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
|
|
32 } // namespace std
|
|
33
|
|
34 namespace llvm {
|
|
35 namespace codeview {
|
|
36 const std::error_category &CVErrorCategory();
|
|
37
|
|
38 inline std::error_code make_error_code(cv_error_code E) {
|
|
39 return std::error_code(static_cast<int>(E), CVErrorCategory());
|
|
40 }
|
120
|
41
|
|
42 /// Base class for errors originating when parsing raw PDB files
|
147
|
43 class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
|
120
|
44 public:
|
147
|
45 using ErrorInfo<CodeViewError,
|
|
46 StringError>::ErrorInfo; // inherit constructors
|
|
47 CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
|
120
|
48 static char ID;
|
147
|
49 };
|
120
|
50
|
147
|
51 } // namespace codeview
|
|
52 } // namespace llvm
|
120
|
53
|
|
54 #endif
|