2016-05-07 04:51:57 +08:00
|
|
|
//===- Error.cpp - system_error extensions for PDB --------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/GenericError.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include "llvm/Support/ManagedStatic.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
using namespace llvm::pdb;
|
|
|
|
|
2016-05-25 04:13:46 +08:00
|
|
|
// 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.
|
2018-09-01 01:41:58 +08:00
|
|
|
class PDBErrorCategory : public std::error_category {
|
2016-05-07 04:51:57 +08:00
|
|
|
public:
|
2016-10-20 07:52:38 +08:00
|
|
|
const char *name() const noexcept override { return "llvm.pdb"; }
|
2016-05-07 04:51:57 +08:00
|
|
|
std::string message(int Condition) const override {
|
2018-09-01 01:41:58 +08:00
|
|
|
switch (static_cast<pdb_error_code>(Condition)) {
|
|
|
|
case pdb_error_code::unspecified:
|
2016-05-07 04:51:57 +08:00
|
|
|
return "An unknown error has occurred.";
|
2018-09-01 01:41:58 +08:00
|
|
|
case pdb_error_code::dia_sdk_not_present:
|
|
|
|
return "LLVM was not compiled with support for DIA. This usually means "
|
2018-04-09 12:37:53 +08:00
|
|
|
"that you are not using MSVC, or your Visual Studio "
|
2018-09-01 01:41:58 +08:00
|
|
|
"installation is corrupt.";
|
|
|
|
case pdb_error_code::dia_failed_loading:
|
|
|
|
return "DIA is only supported when using MSVC.";
|
|
|
|
case pdb_error_code::invalid_utf8_path:
|
|
|
|
return "The PDB file path is an invalid UTF8 sequence.";
|
|
|
|
case pdb_error_code::signature_out_of_date:
|
2018-09-10 21:51:21 +08:00
|
|
|
return "The signature does not match; the file(s) might be out of date.";
|
2018-11-08 22:42:37 +08:00
|
|
|
case pdb_error_code::external_cmdline_ref:
|
|
|
|
return "The path to this file must be provided on the command-line.";
|
2016-05-07 04:51:57 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Unrecognized generic_error_code");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-01 01:41:58 +08:00
|
|
|
static llvm::ManagedStatic<PDBErrorCategory> PDBCategory;
|
|
|
|
const std::error_category &llvm::pdb::PDBErrCategory() { return *PDBCategory; }
|
2016-05-07 04:51:57 +08:00
|
|
|
|
2018-09-01 01:41:58 +08:00
|
|
|
char PDBError::ID;
|