Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/MSF/MSFError.cpp
35266 views
//===- MSFError.cpp - Error extensions for MSF files ------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/MSF/MSFError.h"9#include "llvm/Support/ErrorHandling.h"10#include <string>1112using namespace llvm;13using namespace llvm::msf;1415namespace {16// FIXME: This class is only here to support the transition to llvm::Error. It17// will be removed once this transition is complete. Clients should prefer to18// deal with the Error value directly, rather than converting to error_code.19class MSFErrorCategory : public std::error_category {20public:21const char *name() const noexcept override { return "llvm.msf"; }22std::string message(int Condition) const override {23switch (static_cast<msf_error_code>(Condition)) {24case msf_error_code::unspecified:25return "An unknown error has occurred.";26case msf_error_code::insufficient_buffer:27return "The buffer is not large enough to read the requested number of "28"bytes.";29case msf_error_code::size_overflow_4096:30return "Output data is larger than 4 GiB.";31case msf_error_code::size_overflow_8192:32return "Output data is larger than 8 GiB.";33case msf_error_code::size_overflow_16384:34return "Output data is larger than 16 GiB.";35case msf_error_code::size_overflow_32768:36return "Output data is larger than 32 GiB.";37case msf_error_code::not_writable:38return "The specified stream is not writable.";39case msf_error_code::no_stream:40return "The specified stream does not exist.";41case msf_error_code::invalid_format:42return "The data is in an unexpected format.";43case msf_error_code::block_in_use:44return "The block is already in use.";45case msf_error_code::stream_directory_overflow:46return "PDB stream directory too large.";47}48llvm_unreachable("Unrecognized msf_error_code");49}50};51} // namespace5253const std::error_category &llvm::msf::MSFErrCategory() {54static MSFErrorCategory MSFCategory;55return MSFCategory;56}5758char MSFError::ID;596061