1 //===- RawError.h - Error extensions for raw PDB implementation -*- 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_RAW_RAWERROR_H 11 #define LLVM_DEBUGINFO_PDB_RAW_RAWERROR_H 12 13 #include "llvm/Support/Error.h" 14 15 #include <string> 16 17 namespace llvm { 18 namespace pdb { 19 enum class raw_error_code { 20 unspecified = 1, 21 feature_unsupported, 22 corrupt_file, 23 insufficient_buffer, 24 no_stream, 25 index_out_of_bounds, 26 invalid_block_address, 27 not_writable, 28 invalid_tpi_hash, 29 }; 30 31 /// Base class for errors originating when parsing raw PDB files 32 class RawError : public ErrorInfo<RawError> { 33 public: 34 static char ID; 35 RawError(raw_error_code C); 36 RawError(const std::string &Context); 37 RawError(raw_error_code C, const std::string &Context); 38 39 void log(raw_ostream &OS) const override; 40 const std::string &getErrorMessage() const; 41 std::error_code convertToErrorCode() const override; 42 43 private: 44 std::string ErrMsg; 45 raw_error_code Code; 46 }; 47 } 48 } 49 #endif 50