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

source code of llvm/include/llvm/DebugInfo/CodeView/CodeViewError.h