Line data Source code
1 : //===- PDBFileBuilder.h - PDB File Creation ---------------------*- 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_PDBFILEBUILDER_H
11 : #define LLVM_DEBUGINFO_PDB_RAW_PDBFILEBUILDER_H
12 :
13 : #include "llvm/ADT/ArrayRef.h"
14 : #include "llvm/ADT/BitVector.h"
15 : #include "llvm/ADT/Optional.h"
16 : #include "llvm/DebugInfo/PDB/Raw/NamedStreamMap.h"
17 : #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
18 : #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
19 : #include "llvm/DebugInfo/PDB/Raw/StringTableBuilder.h"
20 : #include "llvm/Support/Allocator.h"
21 : #include "llvm/Support/Endian.h"
22 : #include "llvm/Support/Error.h"
23 :
24 : #include <memory>
25 : #include <vector>
26 :
27 : namespace llvm {
28 : namespace msf {
29 : class MSFBuilder;
30 : }
31 : namespace pdb {
32 : class DbiStreamBuilder;
33 : class InfoStreamBuilder;
34 : class TpiStreamBuilder;
35 :
36 16 : class PDBFileBuilder {
37 : public:
38 : explicit PDBFileBuilder(BumpPtrAllocator &Allocator);
39 : PDBFileBuilder(const PDBFileBuilder &) = delete;
40 : PDBFileBuilder &operator=(const PDBFileBuilder &) = delete;
41 :
42 : Error initialize(uint32_t BlockSize);
43 :
44 : msf::MSFBuilder &getMsfBuilder();
45 : InfoStreamBuilder &getInfoBuilder();
46 : DbiStreamBuilder &getDbiBuilder();
47 : TpiStreamBuilder &getTpiBuilder();
48 : TpiStreamBuilder &getIpiBuilder();
49 : StringTableBuilder &getStringTableBuilder();
50 :
51 : Error commit(StringRef Filename);
52 :
53 : private:
54 : Error addNamedStream(StringRef Name, uint32_t Size);
55 : Expected<msf::MSFLayout> finalizeMsfLayout();
56 :
57 : BumpPtrAllocator &Allocator;
58 :
59 : std::unique_ptr<msf::MSFBuilder> Msf;
60 : std::unique_ptr<InfoStreamBuilder> Info;
61 : std::unique_ptr<DbiStreamBuilder> Dbi;
62 : std::unique_ptr<TpiStreamBuilder> Tpi;
63 : std::unique_ptr<TpiStreamBuilder> Ipi;
64 :
65 : StringTableBuilder Strings;
66 : NamedStreamMap NamedStreams;
67 : };
68 : }
69 : }
70 :
71 : #endif
|