Line data Source code
1 : //===- ModInfoBuilder.h - PDB module information ----------------*- 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_MODINFOBUILDER_H
11 : #define LLVM_DEBUGINFO_PDB_RAW_MODINFOBUILDER_H
12 :
13 : #include "llvm/ADT/StringRef.h"
14 : #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
15 : #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
16 : #include "llvm/Support/Error.h"
17 : #include <cstdint>
18 : #include <string>
19 : #include <vector>
20 :
21 : namespace llvm {
22 : class BinaryStreamWriter;
23 :
24 : namespace msf {
25 : class MSFBuilder;
26 : struct MSFLayout;
27 : }
28 : namespace pdb {
29 :
30 80 : class ModInfoBuilder {
31 : friend class DbiStreamBuilder;
32 :
33 : public:
34 : ModInfoBuilder(StringRef ModuleName, uint32_t ModIndex, msf::MSFBuilder &Msf);
35 :
36 : ModInfoBuilder(const ModInfoBuilder &) = delete;
37 : ModInfoBuilder &operator=(const ModInfoBuilder &) = delete;
38 :
39 : void setObjFileName(StringRef Name);
40 : void addSymbol(codeview::CVSymbol Symbol);
41 :
42 : uint16_t getStreamIndex() const;
43 : StringRef getModuleName() const { return ModuleName; }
44 : StringRef getObjFileName() const { return ObjFileName; }
45 :
46 : ArrayRef<std::string> source_files() const {
47 160 : return makeArrayRef(SourceFiles);
48 : }
49 :
50 : uint32_t calculateSerializedLength() const;
51 :
52 : void finalize();
53 : Error finalizeMsfLayout();
54 :
55 : Error commit(BinaryStreamWriter &ModiWriter, const msf::MSFLayout &MsfLayout,
56 : WritableBinaryStreamRef MsfBuffer);
57 :
58 : private:
59 : void addSourceFile(StringRef Path);
60 : msf::MSFBuilder &MSF;
61 :
62 : uint32_t SymbolByteSize = 0;
63 : std::string ModuleName;
64 : std::string ObjFileName;
65 : std::vector<std::string> SourceFiles;
66 : std::vector<codeview::CVSymbol> Symbols;
67 : ModuleInfoHeader Layout;
68 : };
69 :
70 : } // end namespace pdb
71 :
72 : } // end namespace llvm
73 :
74 : #endif // LLVM_DEBUGINFO_PDB_RAW_MODINFOBUILDER_H
|