Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/RawError.cpp
35293 views
#include "llvm/DebugInfo/PDB/Native/RawError.h"1#include "llvm/Support/ErrorHandling.h"23using namespace llvm;4using namespace llvm::pdb;56namespace {7// FIXME: This class is only here to support the transition to llvm::Error. It8// will be removed once this transition is complete. Clients should prefer to9// deal with the Error value directly, rather than converting to error_code.10class RawErrorCategory : public std::error_category {11public:12const char *name() const noexcept override { return "llvm.pdb.raw"; }13std::string message(int Condition) const override {14switch (static_cast<raw_error_code>(Condition)) {15case raw_error_code::unspecified:16return "An unknown error has occurred.";17case raw_error_code::feature_unsupported:18return "The feature is unsupported by the implementation.";19case raw_error_code::invalid_format:20return "The record is in an unexpected format.";21case raw_error_code::corrupt_file:22return "The PDB file is corrupt.";23case raw_error_code::insufficient_buffer:24return "The buffer is not large enough to read the requested number of "25"bytes.";26case raw_error_code::no_stream:27return "The specified stream could not be loaded.";28case raw_error_code::index_out_of_bounds:29return "The specified item does not exist in the array.";30case raw_error_code::invalid_block_address:31return "The specified block address is not valid.";32case raw_error_code::duplicate_entry:33return "The entry already exists.";34case raw_error_code::no_entry:35return "The entry does not exist.";36case raw_error_code::not_writable:37return "The PDB does not support writing.";38case raw_error_code::stream_too_long:39return "The stream was longer than expected.";40case raw_error_code::invalid_tpi_hash:41return "The Type record has an invalid hash value.";42}43llvm_unreachable("Unrecognized raw_error_code");44}45};46} // namespace4748const std::error_category &llvm::pdb::RawErrCategory() {49static RawErrorCategory RawCategory;50return RawCategory;51}5253char RawError::ID;545556