brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 0bd93a0 Raw
39 lines · cpp
1#include "llvm/DebugInfo/PDB/DIA/DIAError.h"2#include "llvm/Support/ErrorHandling.h"3 4using namespace llvm;5using namespace llvm::pdb;6 7// FIXME: This class is only here to support the transition to llvm::Error. It8// will be removed once this transition is complete. Clients should prefer to9// deal with the Error value directly, rather than converting to error_code.10class DIAErrorCategory : public std::error_category {11public:12  const char *name() const noexcept override { return "llvm.pdb.dia"; }13  std::string message(int Condition) const override {14    switch (static_cast<dia_error_code>(Condition)) {15    case dia_error_code::could_not_create_impl:16      return "Failed to connect to DIA at runtime. Verify that Visual Studio "17             "is properly installed, or that msdiaXX.dll is in your PATH.";18    case dia_error_code::invalid_file_format:19      return "Unable to load PDB. The file has an unrecognized format.";20    case dia_error_code::invalid_parameter:21      return "The parameter is incorrect.";22    case dia_error_code::already_loaded:23      return "Unable to load the PDB or EXE, because it is already loaded.";24    case dia_error_code::debug_info_mismatch:25      return "The PDB file and the EXE file do not match.";26    case dia_error_code::unspecified:27      return "An unknown error has occurred.";28    }29    llvm_unreachable("Unrecognized DIAErrorCode");30  }31};32 33const std::error_category &llvm::pdb::DIAErrCategory() {34  static DIAErrorCategory DIACategory;35  return DIACategory;36}37 38char DIAError::ID;39