Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp
35271 views
//===- CodeViewError.cpp - Error extensions for CodeView --------*- 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/CodeView/CodeViewError.h"9#include "llvm/Support/ErrorHandling.h"10#include <string>1112using namespace llvm;13using namespace llvm::codeview;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 CodeViewErrorCategory : public std::error_category {20public:21const char *name() const noexcept override { return "llvm.codeview"; }22std::string message(int Condition) const override {23switch (static_cast<cv_error_code>(Condition)) {24case cv_error_code::unspecified:25return "An unknown CodeView error has occurred.";26case cv_error_code::insufficient_buffer:27return "The buffer is not large enough to read the requested number of "28"bytes.";29case cv_error_code::corrupt_record:30return "The CodeView record is corrupted.";31case cv_error_code::no_records:32return "There are no records.";33case cv_error_code::operation_unsupported:34return "The requested operation is not supported.";35case cv_error_code::unknown_member_record:36return "The member record is of an unknown type.";37}38llvm_unreachable("Unrecognized cv_error_code");39}40};41} // namespace4243const std::error_category &llvm::codeview::CVErrorCategory() {44static CodeViewErrorCategory CodeViewErrCategory;45return CodeViewErrCategory;46}4748char CodeViewError::ID;495051