1819e77d1SZachary Turner #include "llvm/DebugInfo/PDB/DIA/DIAError.h" 2819e77d1SZachary Turner #include "llvm/Support/ErrorHandling.h" 3819e77d1SZachary Turner 4819e77d1SZachary Turner using namespace llvm; 5819e77d1SZachary Turner using namespace llvm::pdb; 6819e77d1SZachary Turner 74718f8b5SPeter Collingbourne // FIXME: This class is only here to support the transition to llvm::Error. It 84718f8b5SPeter Collingbourne // will be removed once this transition is complete. Clients should prefer to 94718f8b5SPeter Collingbourne // deal with the Error value directly, rather than converting to error_code. 10819e77d1SZachary Turner class DIAErrorCategory : public std::error_category { 11819e77d1SZachary Turner public: name() const12990504e6SReid Kleckner const char *name() const noexcept override { return "llvm.pdb.dia"; } message(int Condition) const13819e77d1SZachary Turner std::string message(int Condition) const override { 14819e77d1SZachary Turner switch (static_cast<dia_error_code>(Condition)) { 15819e77d1SZachary Turner case dia_error_code::could_not_create_impl: 16819e77d1SZachary Turner return "Failed to connect to DIA at runtime. Verify that Visual Studio " 17819e77d1SZachary Turner "is properly installed, or that msdiaXX.dll is in your PATH."; 18819e77d1SZachary Turner case dia_error_code::invalid_file_format: 19819e77d1SZachary Turner return "Unable to load PDB. The file has an unrecognized format."; 20819e77d1SZachary Turner case dia_error_code::invalid_parameter: 21819e77d1SZachary Turner return "The parameter is incorrect."; 22819e77d1SZachary Turner case dia_error_code::already_loaded: 23819e77d1SZachary Turner return "Unable to load the PDB or EXE, because it is already loaded."; 24819e77d1SZachary Turner case dia_error_code::debug_info_mismatch: 25819e77d1SZachary Turner return "The PDB file and the EXE file do not match."; 26819e77d1SZachary Turner case dia_error_code::unspecified: 27819e77d1SZachary Turner return "An unknown error has occurred."; 28819e77d1SZachary Turner } 29819e77d1SZachary Turner llvm_unreachable("Unrecognized DIAErrorCode"); 30819e77d1SZachary Turner } 31819e77d1SZachary Turner }; 32819e77d1SZachary Turner DIAErrCategory()33*ede60037SNicolai Hähnleconst std::error_category &llvm::pdb::DIAErrCategory() { 34*ede60037SNicolai Hähnle static DIAErrorCategory DIACategory; 35*ede60037SNicolai Hähnle return DIACategory; 36*ede60037SNicolai Hähnle } 37819e77d1SZachary Turner 386a7efef4SAlexandre Ganea char DIAError::ID; 39