File: RawError.cpp

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (54 lines) | stat: -rw-r--r-- 2,127 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/ErrorHandling.h"

using namespace llvm;
using namespace llvm::pdb;

namespace {
// FIXME: This class is only here to support the transition to llvm::Error. It
// will be removed once this transition is complete. Clients should prefer to
// deal with the Error value directly, rather than converting to error_code.
class RawErrorCategory : public std::error_category {
public:
  const char *name() const noexcept override { return "llvm.pdb.raw"; }
  std::string message(int Condition) const override {
    switch (static_cast<raw_error_code>(Condition)) {
    case raw_error_code::unspecified:
      return "An unknown error has occurred.";
    case raw_error_code::feature_unsupported:
      return "The feature is unsupported by the implementation.";
    case raw_error_code::invalid_format:
      return "The record is in an unexpected format.";
    case raw_error_code::corrupt_file:
      return "The PDB file is corrupt.";
    case raw_error_code::insufficient_buffer:
      return "The buffer is not large enough to read the requested number of "
             "bytes.";
    case raw_error_code::no_stream:
      return "The specified stream could not be loaded.";
    case raw_error_code::index_out_of_bounds:
      return "The specified item does not exist in the array.";
    case raw_error_code::invalid_block_address:
      return "The specified block address is not valid.";
    case raw_error_code::duplicate_entry:
      return "The entry already exists.";
    case raw_error_code::no_entry:
      return "The entry does not exist.";
    case raw_error_code::not_writable:
      return "The PDB does not support writing.";
    case raw_error_code::stream_too_long:
      return "The stream was longer than expected.";
    case raw_error_code::invalid_tpi_hash:
      return "The Type record has an invalid hash value.";
    }
    llvm_unreachable("Unrecognized raw_error_code");
  }
};
} // namespace

const std::error_category &llvm::pdb::RawErrCategory() {
  static RawErrorCategory RawCategory;
  return RawCategory;
}

char RawError::ID;