1 //===- Error.h - system_error extensions for PDB ----------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_DEBUGINFO_PDB_ERROR_H 11 #define LLVM_DEBUGINFO_PDB_ERROR_H 12 13 #include "llvm/Support/Error.h" 14 15 namespace llvm { 16 namespace pdb { 17 18 enum class generic_error_code { 19 invalid_path = 1, 20 dia_sdk_not_present, 21 unspecified, 22 }; 23 24 /// Base class for errors originating when parsing raw PDB files 25 class GenericError : public ErrorInfo<GenericError> { 26 public: 27 static char ID; 28 GenericError(generic_error_code C); 29 GenericError(const std::string &Context); 30 GenericError(generic_error_code C, const std::string &Context); 31 32 void log(raw_ostream &OS) const override; 33 const std::string &getErrorMessage() const; 34 std::error_code convertToErrorCode() const override; 35 36 private: 37 std::string ErrMsg; 38 generic_error_code Code; 39 }; 40 } 41 } 42 #endif 43