LLVM  12.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 
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 "The specified stream is not writable.";
33  return "The specified stream does not exist.";
35  return "The data is in an unexpected format.";
37  return "The block is already in use.";
38  }
39  llvm_unreachable("Unrecognized msf_error_code");
40  }
41 };
42 } // namespace
43 
46 
47 char MSFError::ID;
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static const char * name
static char ID
Definition: MSFError.h:47
static ManagedStatic< _object_error_category > error_category
Definition: Error.cpp:76
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static llvm::ManagedStatic< MSFErrorCategory > MSFCategory
Definition: MSFError.cpp:44
aarch64 promote const
const std::error_category & MSFErrCategory()
Definition: MSFError.cpp:45
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83