[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / lib / DebugInfo / CodeView / CodeViewError.cpp
blobd12f6c796e50001792da6da1c190903b248543b8
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 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
10 #include "llvm/Support/ErrorHandling.h"
11 #include "llvm/Support/ManagedStatic.h"
12 #include <string>
14 using namespace llvm;
15 using namespace llvm::codeview;
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)) {
26 case cv_error_code::unspecified:
27 return "An unknown CodeView error has occurred.";
28 case cv_error_code::insufficient_buffer:
29 return "The buffer is not large enough to read the requested number of "
30 "bytes.";
31 case cv_error_code::corrupt_record:
32 return "The CodeView record is corrupted.";
33 case cv_error_code::no_records:
34 return "There are no records.";
35 case cv_error_code::operation_unsupported:
36 return "The requested operation is not supported.";
37 case cv_error_code::unknown_member_record:
38 return "The member record is of an unknown type.";
40 llvm_unreachable("Unrecognized cv_error_code");
43 } // namespace
45 static llvm::ManagedStatic<CodeViewErrorCategory> CodeViewErrCategory;
46 const std::error_category &llvm::codeview::CVErrorCategory() {
47 return *CodeViewErrCategory;
50 char CodeViewError::ID;