Home | History | Annotate | Download | only in CodeView
      1 //===- CodeViewError.h - Error extensions for CodeView ----------*- 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_CODEVIEW_CODEVIEWERROR_H
     11 #define LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
     12 
     13 #include "llvm/Support/Error.h"
     14 
     15 #include <string>
     16 
     17 namespace llvm {
     18 namespace codeview {
     19 enum class cv_error_code {
     20   unspecified = 1,
     21   insufficient_buffer,
     22   operation_unsupported,
     23   corrupt_record,
     24 };
     25 
     26 /// Base class for errors originating when parsing raw PDB files
     27 class CodeViewError : public ErrorInfo<CodeViewError> {
     28 public:
     29   static char ID;
     30   CodeViewError(cv_error_code C);
     31   CodeViewError(const std::string &Context);
     32   CodeViewError(cv_error_code C, const std::string &Context);
     33 
     34   void log(raw_ostream &OS) const override;
     35   const std::string &getErrorMessage() const;
     36   std::error_code convertToErrorCode() const override;
     37 
     38 private:
     39   std::string ErrMsg;
     40   cv_error_code Code;
     41 };
     42 }
     43 }
     44 #endif
     45