1 //===- DbiModuleDescriptorBuilder.h - PDB module information ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H
11 #define LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
15 #include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
16 #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"
17 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
18 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
19 #include "llvm/Support/Error.h"
25 class BinaryStreamWriter;
28 class ModuleDebugFragmentRecordBuilder;
37 class DbiModuleDescriptorBuilder {
38 friend class DbiStreamBuilder;
41 DbiModuleDescriptorBuilder(StringRef ModuleName, uint32_t ModIndex,
42 msf::MSFBuilder &Msf);
43 ~DbiModuleDescriptorBuilder();
45 DbiModuleDescriptorBuilder(const DbiModuleDescriptorBuilder &) = delete;
46 DbiModuleDescriptorBuilder &
47 operator=(const DbiModuleDescriptorBuilder &) = delete;
49 void setObjFileName(StringRef Name);
50 void addSymbol(codeview::CVSymbol Symbol);
52 void addC13Fragment(std::unique_ptr<codeview::ModuleDebugLineFragment> Lines);
54 std::unique_ptr<codeview::ModuleDebugInlineeLineFragment> Inlinees);
55 void setC13FileChecksums(
56 std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> Checksums);
58 uint16_t getStreamIndex() const;
59 StringRef getModuleName() const { return ModuleName; }
60 StringRef getObjFileName() const { return ObjFileName; }
62 ArrayRef<std::string> source_files() const {
63 return makeArrayRef(SourceFiles);
66 uint32_t calculateSerializedLength() const;
69 Error finalizeMsfLayout();
71 Error commit(BinaryStreamWriter &ModiWriter, const msf::MSFLayout &MsfLayout,
72 WritableBinaryStreamRef MsfBuffer);
75 uint32_t calculateC13DebugInfoSize() const;
77 void addSourceFile(StringRef Path);
80 uint32_t SymbolByteSize = 0;
81 std::string ModuleName;
82 std::string ObjFileName;
83 std::vector<std::string> SourceFiles;
84 std::vector<codeview::CVSymbol> Symbols;
86 std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> ChecksumInfo;
87 std::vector<std::unique_ptr<codeview::ModuleDebugLineFragment>> LineInfo;
88 std::vector<std::unique_ptr<codeview::ModuleDebugInlineeLineFragment>>
91 std::vector<std::unique_ptr<codeview::ModuleDebugFragmentRecordBuilder>>
94 ModuleInfoHeader Layout;
97 } // end namespace pdb
99 } // end namespace llvm
101 #endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H