[InstCombine] Signed saturation patterns
[llvm-core.git] / include / llvm / DebugInfo / CodeView / CodeViewError.h
blob9990c8d05d1cfa83ea83d30e04606baa9b05d3e3
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
10 #define LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
12 #include "llvm/Support/Error.h"
14 #include <string>
16 namespace llvm {
17 namespace codeview {
18 enum class cv_error_code {
19 unspecified = 1,
20 insufficient_buffer,
21 operation_unsupported,
22 corrupt_record,
23 no_records,
24 unknown_member_record,
26 } // namespace codeview
27 } // namespace llvm
29 namespace std {
30 template <>
31 struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
32 } // namespace std
34 namespace llvm {
35 namespace codeview {
36 const std::error_category &CVErrorCategory();
38 inline std::error_code make_error_code(cv_error_code E) {
39 return std::error_code(static_cast<int>(E), CVErrorCategory());
42 /// Base class for errors originating when parsing raw PDB files
43 class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
44 public:
45 using ErrorInfo<CodeViewError,
46 StringError>::ErrorInfo; // inherit constructors
47 CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
48 static char ID;
51 } // namespace codeview
52 } // namespace llvm
54 #endif