diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp index 21e5e4bc0db..a8b80ac6d78 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -15,6 +15,7 @@ #include "llvm/DebugInfo/PDB/GenericError.h" #include "llvm/DebugInfo/PDB/Native/DbiStream.h" #include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h" +#include "llvm/DebugInfo/PDB/Native/GlobalsStreamBuilder.h" #include "llvm/DebugInfo/PDB/Native/InfoStream.h" #include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h" #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h" @@ -80,6 +81,12 @@ PublicsStreamBuilder &PDBFileBuilder::getPublicsBuilder() { return *Publics; } +GlobalsStreamBuilder &PDBFileBuilder::getGlobalsBuilder() { + if (!Globals) + Globals = llvm::make_unique<GlobalsStreamBuilder>(*Msf); + return *Globals; +} + Error PDBFileBuilder::addNamedStream(StringRef Name, uint32_t Size) { auto ExpectedStream = Msf->addStream(Size); if (!ExpectedStream) @@ -131,6 +138,13 @@ Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() { } } + if (Globals) { + if (auto EC = Globals->finalizeMsfLayout()) + return std::move(EC); + if (Dbi) + Dbi->setGlobalsStreamIndex(Globals->getStreamIndex()); + } + return Msf->build(); } @@ -220,5 +234,13 @@ Error PDBFileBuilder::commit(StringRef Filename) { return EC; } + if (Globals) { + auto GS = WritableMappedBlockStream::createIndexedStream( + Layout, Buffer, Globals->getStreamIndex(), Allocator); + BinaryStreamWriter GSWriter(*GS); + if (auto EC = Globals->commit(GSWriter)) + return EC; + } + return Buffer.commit(); } |