46 : MSF(Msf), ModuleName(
std::string(ModuleName)) {
47 ::memset(&Layout, 0,
sizeof(Layout));
48 Layout.Mod = ModIndex;
54 return Layout.ModDiStream;
58 ObjFileName = std::string(Name);
78 if (BulkSymbols.
empty())
85 "Invalid Symbol alignment!");
86 SymbolByteSize += BulkSymbols.
size();
97 "Invalid Symbol alignment!");
98 SymbolByteSize += SymLength;
101void DbiModuleDescriptorBuilder::addSourceFile(
StringRef Path) {
105uint32_t DbiModuleDescriptorBuilder::calculateC13DebugInfoSize()
const {
107 for (
const auto &Builder : C13Builders) {
108 Result += Builder.calculateSerializedLength();
116 uint32_t O = ObjFileName.size() + 1;
121 Layout.FileNameOffs = 0;
124 Layout.C13Bytes = calculateC13DebugInfoSize();
126 (void)Layout.ModDiStream;
127 Layout.NumFiles = SourceFiles.size();
128 Layout.PdbFilePathNI = PdbFilePathNI;
129 Layout.SrcFileNameNI = 0;
139 uint32_t C13Size = calculateC13DebugInfoSize();
140 if (!C13Size && !SymbolByteSize)
145 return ExpectedSN.takeError();
146 Layout.ModDiStream = *ExpectedSN;
170 MsfLayout, MsfBuffer, Layout.ModDiStream, MSF.getAllocator());
177 if (Sym.NeedsToBeMerged) {
178 assert(MergeSymsCallback);
179 if (
auto EC = MergeSymsCallback(MergeSymsCtx, Sym.SymPtr, SymbolWriter))
188 auto SavedOffset = SymbolWriter.
getOffset();
197 "Invalid debug section alignment!");
199 for (
const auto &Builder : C13Builders) {
214 std::shared_ptr<DebugSubsection> Subsection) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static uint32_t calculateDiSymbolStreamSize(uint32_t SymbolByteSize, uint32_t C13Size)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
Provides write only access to a subclass of WritableBinaryStream.
LLVM_ABI Error writeCString(StringRef Str)
Write the string Str to the underlying stream followed by a null terminator.
uint64_t getOffset() const
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
uint64_t bytesRemaining() const
LLVM_ABI Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
void setOffset(uint64_t Off)
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
LLVM_ABI Error padToAlignment(uint32_t Align)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
static std::unique_ptr< WritableMappedBlockStream > createIndexedStream(const MSFLayout &Layout, WritableBinaryStreamRef MsfData, uint32_t StreamIndex, BumpPtrAllocator &Allocator)
LLVM_ABI void addUnmergedSymbols(void *SymSrc, uint32_t SymLength)
LLVM_ABI void setObjFileName(StringRef Name)
LLVM_ABI ~DbiModuleDescriptorBuilder()
LLVM_ABI void setFirstSectionContrib(const SectionContrib &SC)
LLVM_ABI Error finalizeMsfLayout()
LLVM_ABI uint16_t getStreamIndex() const
LLVM_ABI void addSymbol(codeview::CVSymbol Symbol)
LLVM_ABI void setPdbFilePathNI(uint32_t NI)
LLVM_ABI Error commitSymbolStream(const msf::MSFLayout &MsfLayout, WritableBinaryStreamRef MsfBuffer)
Commit the accumulated symbols to the module symbol stream.
LLVM_ABI Error commit(BinaryStreamWriter &ModiWriter)
Commit the DBI descriptor to the DBI stream.
LLVM_ABI void addDebugSubsection(std::shared_ptr< codeview::DebugSubsection > Subsection)
uint32_t getNextSymbolOffset() const
Return the offset within the module symbol stream of the next symbol record passed to addSymbol.
LLVM_ABI void addSymbolsInBulk(ArrayRef< uint8_t > BulkSymbols)
LLVM_ABI DbiModuleDescriptorBuilder(StringRef ModuleName, uint32_t ModIndex, msf::MSFBuilder &Msf)
LLVM_ABI uint32_t calculateSerializedLength() const
CVRecord< SymbolKind > CVSymbol
uint32_t alignOf(CodeViewContainer Container)
const uint16_t kInvalidStreamIndex
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
@ Ref
The access may reference the value stored in memory.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Implement std::hash so that hash_code can be used in STL containers.
Represents a string table reference at some offset in the module symbol stream.