LLVM  14.0.0git
CodeViewError.cpp
Go to the documentation of this file.
1 //===- CodeViewError.cpp - 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 
12 #include <string>
13 
14 using namespace llvm;
15 using namespace llvm::codeview;
16 
17 namespace {
18 // FIXME: This class is only here to support the transition to llvm::Error. It
19 // will be removed once this transition is complete. Clients should prefer to
20 // deal with the Error value directly, rather than converting to error_code.
21 class CodeViewErrorCategory : public std::error_category {
22 public:
23  const char *name() const noexcept override { return "llvm.codeview"; }
24  std::string message(int Condition) const override {
25  switch (static_cast<cv_error_code>(Condition)) {
27  return "An unknown CodeView error has occurred.";
29  return "The buffer is not large enough to read the requested number of "
30  "bytes.";
32  return "The CodeView record is corrupted.";
34  return "There are no records.";
36  return "The requested operation is not supported.";
38  return "The member record is of an unknown type.";
39  }
40  llvm_unreachable("Unrecognized cv_error_code");
41  }
42 };
43 } // namespace
44 
47  return *CodeViewErrCategory;
48 }
49 
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::codeview::cv_error_code::operation_unsupported
@ operation_unsupported
CodeViewErrCategory
static llvm::ManagedStatic< CodeViewErrorCategory > CodeViewErrCategory
Definition: CodeViewError.cpp:45
ErrorHandling.h
ManagedStatic.h
llvm::codeview::cv_error_code::insufficient_buffer
@ insufficient_buffer
llvm::codeview::CVErrorCategory
const std::error_category & CVErrorCategory()
Definition: CodeViewError.cpp:46
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
llvm::codeview::cv_error_code::no_records
@ no_records
llvm::codeview::CodeViewError::ID
static char ID
Definition: CodeViewError.h:46
llvm::codeview::cv_error_code
cv_error_code
Definition: CodeViewError.h:16
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
message
message(STATUS "Targeting ${t}") add_subdirectory($
Definition: CMakeLists.txt:33
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
llvm::codeview::cv_error_code::corrupt_record
@ corrupt_record
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::cv_error_code::unknown_member_record
@ unknown_member_record
CodeViewError.h
error_category
static ManagedStatic< _object_error_category > error_category
Definition: Error.cpp:76
llvm::codeview::cv_error_code::unspecified
@ unspecified