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/DebugChecksumsSubsection.h"
15 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
16 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.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 DebugSubsectionRecordBuilder;
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);
53 addDebugSubsection(std::shared_ptr<codeview::DebugSubsection> Subsection);
55 uint16_t getStreamIndex() const;
56 StringRef getModuleName() const { return ModuleName; }
57 StringRef getObjFileName() const { return ObjFileName; }
59 unsigned getModuleIndex() const { return Layout.Mod; }
61 ArrayRef<std::string> source_files() const {
62 return makeArrayRef(SourceFiles);
65 uint32_t calculateSerializedLength() const;
68 Error finalizeMsfLayout();
70 Error commit(BinaryStreamWriter &ModiWriter, const msf::MSFLayout &MsfLayout,
71 WritableBinaryStreamRef MsfBuffer);
74 uint32_t calculateC13DebugInfoSize() const;
76 void addSourceFile(StringRef Path);
79 uint32_t SymbolByteSize = 0;
80 std::string ModuleName;
81 std::string ObjFileName;
82 std::vector<std::string> SourceFiles;
83 std::vector<codeview::CVSymbol> Symbols;
85 std::vector<std::unique_ptr<codeview::DebugSubsectionRecordBuilder>>
88 ModuleInfoHeader Layout;
91 } // end namespace pdb
93 } // end namespace llvm
95 #endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H