Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/GenericError.cpp
35266 views
//===- Error.cpp - system_error extensions for PDB --------------*- 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/PDB/GenericError.h"9#include "llvm/Support/ErrorHandling.h"1011using namespace llvm;12using namespace llvm::pdb;1314namespace {15// FIXME: This class is only here to support the transition to llvm::Error. It16// will be removed once this transition is complete. Clients should prefer to17// deal with the Error value directly, rather than converting to error_code.18class PDBErrorCategory : public std::error_category {19public:20const char *name() const noexcept override { return "llvm.pdb"; }21std::string message(int Condition) const override {22switch (static_cast<pdb_error_code>(Condition)) {23case pdb_error_code::unspecified:24return "An unknown error has occurred.";25case pdb_error_code::dia_sdk_not_present:26return "LLVM was not compiled with support for DIA. This usually means "27"that you are not using MSVC, or your Visual Studio "28"installation is corrupt.";29case pdb_error_code::dia_failed_loading:30return "DIA is only supported when using MSVC.";31case pdb_error_code::invalid_utf8_path:32return "The PDB file path is an invalid UTF8 sequence.";33case pdb_error_code::signature_out_of_date:34return "The signature does not match; the file(s) might be out of date.";35case pdb_error_code::no_matching_pch:36return "No matching precompiled header could be located.";37}38llvm_unreachable("Unrecognized generic_error_code");39}40};41} // namespace4243const std::error_category &llvm::pdb::PDBErrCategory() {44static PDBErrorCategory PDBCategory;45return PDBCategory;46}4748char PDBError::ID;495051