LLVM  16.0.0git
MSFError.cpp
Go to the documentation of this file.
1 //===- MSFError.cpp - Error extensions for MSF files ------------*- 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 
11 #include <string>
12 
13 using namespace llvm;
14 using namespace llvm::msf;
15 
16 namespace {
17 // FIXME: This class is only here to support the transition to llvm::Error. It
18 // will be removed once this transition is complete. Clients should prefer to
19 // deal with the Error value directly, rather than converting to error_code.
20 class MSFErrorCategory : public std::error_category {
21 public:
22  const char *name() const noexcept override { return "llvm.msf"; }
23  std::string message(int Condition) const override {
24  switch (static_cast<msf_error_code>(Condition)) {
26  return "An unknown error has occurred.";
28  return "The buffer is not large enough to read the requested number of "
29  "bytes.";
31  return "Output data is larger than 4 GiB.";
33  return "Output data is larger than 8 GiB.";
35  return "Output data is larger than 16 GiB.";
37  return "Output data is larger than 32 GiB.";
39  return "The specified stream is not writable.";
41  return "The specified stream does not exist.";
43  return "The data is in an unexpected format.";
45  return "The block is already in use.";
46  }
47  llvm_unreachable("Unrecognized msf_error_code");
48  }
49 };
50 } // namespace
51 
52 const std::error_category &llvm::msf::MSFErrCategory() {
53  static MSFErrorCategory MSFCategory;
54  return MSFCategory;
55 }
56 
57 char MSFError::ID;
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::msf::msf_error_code
msf_error_code
Definition: MSFError.h:16
llvm::msf::msf_error_code::no_stream
@ no_stream
llvm::msf::msf_error_code::insufficient_buffer
@ insufficient_buffer
name
static const char * name
Definition: SMEABIPass.cpp:49
ErrorHandling.h
llvm::msf
Definition: IMSFFile.h:18
llvm::msf::MSFError::ID
static char ID
Definition: MSFError.h:49
llvm::msf::msf_error_code::not_writable
@ not_writable
llvm::msf::msf_error_code::size_overflow_8192
@ size_overflow_8192
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::msf::msf_error_code::unspecified
@ unspecified
message
message(STATUS "Targeting ${t}") add_subdirectory($
Definition: CMakeLists.txt:34
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::msf::msf_error_code::size_overflow_16384
@ size_overflow_16384
llvm::msf::msf_error_code::size_overflow_4096
@ size_overflow_4096
MSFError.h
llvm::msf::MSFErrCategory
const std::error_category & MSFErrCategory()
Definition: MSFError.cpp:52
llvm::msf::msf_error_code::size_overflow_32768
@ size_overflow_32768
llvm::msf::msf_error_code::invalid_format
@ invalid_format
llvm::msf::msf_error_code::block_in_use
@ block_in_use