mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-05-14 02:56:07 +00:00

Following D50807, and heading towards D50664, this intermediary change does the following: 1. Upgrade all custom Error types in llvm/trunk/lib/DebugInfo/ to use the new StringError behavior (D50807). 2. Implement std::is_error_code_enum and make_error_code() for DebugInfo error enumerations. 3. Rename GenericError -> PDBError (the file will be renamed in a subsequent commit) 4. Update custom error messages to follow the same formatting: (\w\s*)+\. 5. Keep generic "file not found" (ENOENT) errors as they are in PDB code. Previously, there used to be a custom enumeration for that purpose. 6. Remove a few extraneous LF in log() implementations. Printing LF is a responsability at a higher level, not at the error level. Differential Revision: https://reviews.llvm.org/D51499 llvm-svn: 341228
38 lines
1.6 KiB
C++
38 lines
1.6 KiB
C++
#include "llvm/DebugInfo/PDB/DIA/DIAError.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/ManagedStatic.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::pdb;
|
|
|
|
// 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.
|
|
class DIAErrorCategory : public std::error_category {
|
|
public:
|
|
const char *name() const noexcept override { return "llvm.pdb.dia"; }
|
|
std::string message(int Condition) const override {
|
|
switch (static_cast<dia_error_code>(Condition)) {
|
|
case dia_error_code::could_not_create_impl:
|
|
return "Failed to connect to DIA at runtime. Verify that Visual Studio "
|
|
"is properly installed, or that msdiaXX.dll is in your PATH.";
|
|
case dia_error_code::invalid_file_format:
|
|
return "Unable to load PDB. The file has an unrecognized format.";
|
|
case dia_error_code::invalid_parameter:
|
|
return "The parameter is incorrect.";
|
|
case dia_error_code::already_loaded:
|
|
return "Unable to load the PDB or EXE, because it is already loaded.";
|
|
case dia_error_code::debug_info_mismatch:
|
|
return "The PDB file and the EXE file do not match.";
|
|
case dia_error_code::unspecified:
|
|
return "An unknown error has occurred.";
|
|
}
|
|
llvm_unreachable("Unrecognized DIAErrorCode");
|
|
}
|
|
};
|
|
|
|
static llvm::ManagedStatic<DIAErrorCategory> DIACategory;
|
|
const std::error_category &llvm::pdb::DIAErrCategory() { return *DIACategory; }
|
|
|
|
char DIAError::ID;
|