Home | History | Annotate | Download | only in DIA
      1 //===- DIAError.h - Error extensions for PDB DIA 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_DIA_DIAERROR_H
     11 #define LLVM_DEBUGINFO_PDB_DIA_DIAERROR_H
     12 
     13 #include "llvm/Support/Error.h"
     14 
     15 #include <string>
     16 
     17 namespace llvm {
     18 namespace pdb {
     19 enum class dia_error_code {
     20   unspecified = 1,
     21   could_not_create_impl,
     22   invalid_file_format,
     23   invalid_parameter,
     24   already_loaded,
     25   debug_info_mismatch,
     26 };
     27 
     28 /// Base class for errors originating in DIA SDK, e.g. COM calls
     29 class DIAError : public ErrorInfo<DIAError> {
     30 public:
     31   static char ID;
     32   DIAError(dia_error_code C);
     33   DIAError(const std::string &Context);
     34   DIAError(dia_error_code C, const std::string &Context);
     35 
     36   void log(raw_ostream &OS) const override;
     37   const std::string &getErrorMessage() const;
     38   std::error_code convertToErrorCode() const override;
     39 
     40 private:
     41   std::string ErrMsg;
     42   dia_error_code Code;
     43 };
     44 }
     45 }
     46 #endif
     47