summaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo/PDB/GenericError.h
blob: 03205a986f1a5e9c0d21a703680bfd2deb32caa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//===- Error.h - system_error extensions for PDB ----------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEBUGINFO_PDB_ERROR_H
#define LLVM_DEBUGINFO_PDB_ERROR_H

#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"

namespace llvm {
namespace pdb {

enum class generic_error_code {
  invalid_path = 1,
  dia_sdk_not_present,
  type_server_not_found,
  unspecified,
};

/// Base class for errors originating when parsing raw PDB files
class GenericError : public ErrorInfo<GenericError> {
public:
  static char ID;
  GenericError(generic_error_code C);
  GenericError(StringRef Context);
  GenericError(generic_error_code C, StringRef Context);

  void log(raw_ostream &OS) const override;
  StringRef getErrorMessage() const;
  std::error_code convertToErrorCode() const override;

private:
  std::string ErrMsg;
  generic_error_code Code;
};
}
}
#endif