1//===- DebugTypes.h ---------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLD_COFF_DEBUGTYPES_H
10#define LLD_COFF_DEBUGTYPES_H
11
12#include "llvm/Support/Error.h"
13#include "llvm/Support/MemoryBuffer.h"
14
15namespace llvm {
16namespace codeview {
17class PrecompRecord;
18class TypeServer2Record;
19} // namespace codeview
20namespace pdb {
21class NativeSession;
22}
23} // namespace llvm
24
25namespace lld {
26namespace coff {
27
28class ObjFile;
29
30class TpiSource {
31public:
32  enum TpiKind { Regular, PCH, UsingPCH, PDB, UsingPDB };
33
34  TpiSource(TpiKind k, const ObjFile *f);
35  virtual ~TpiSource() {}
36
37  const TpiKind kind;
38  const ObjFile *file;
39};
40
41TpiSource *makeTpiSource(const ObjFile *f);
42TpiSource *makeUseTypeServerSource(const ObjFile *f,
43                                   const llvm::codeview::TypeServer2Record *ts);
44TpiSource *makePrecompSource(const ObjFile *f);
45TpiSource *makeUsePrecompSource(const ObjFile *f,
46                                const llvm::codeview::PrecompRecord *precomp);
47
48void loadTypeServerSource(llvm::MemoryBufferRef m);
49
50// Temporary interface to get the dependency
51template <typename T> const T &retrieveDependencyInfo(const TpiSource *source);
52
53// Temporary interface until we move PDBLinker::maybeMergeTypeServerPDB here
54llvm::Expected<llvm::pdb::NativeSession *>
55findTypeServerSource(const ObjFile *f);
56
57} // namespace coff
58} // namespace lld
59
60#endif