27 using namespace llvm::codeview;
28 using namespace llvm::msf;
29 using namespace llvm::pdb;
30 using namespace llvm::support;
33 : Allocator(Allocator) {}
36 auto ExpectedMsf = MSFBuilder::create(Allocator, BlockSize);
38 return ExpectedMsf.takeError();
39 Msf = llvm::make_unique<MSFBuilder>(std::move(*ExpectedMsf));
47 Info = llvm::make_unique<InfoStreamBuilder>(*Msf);
53 Dbi = llvm::make_unique<DbiStreamBuilder>(*Msf);
59 Tpi = llvm::make_unique<TpiStreamBuilder>(*Msf,
StreamTPI);
65 Ipi = llvm::make_unique<TpiStreamBuilder>(*Msf,
StreamIPI);
71 if (
auto EC = Info->finalizeMsfLayout())
75 if (
auto EC = Dbi->finalizeMsfLayout())
79 if (
auto EC = Tpi->finalizeMsfLayout())
83 if (
auto EC = Ipi->finalizeMsfLayout())
91 auto ExpectedLayout = finalizeMsfLayout();
93 return ExpectedLayout.takeError();
94 auto &Layout = *ExpectedLayout;
96 uint64_t Filesize = Layout.SB->BlockSize * Layout.SB->NumBlocks;
98 if (OutFileOrError.getError())
109 if (
auto EC = Writer.
writeArray(Layout.DirectoryBlocks))
113 WritableMappedBlockStream::createDirectoryStream(Layout, Buffer);
116 DW.
writeInteger(static_cast<uint32_t>(Layout.StreamSizes.size())))
122 for (
const auto &Blocks : Layout.StreamMap) {
128 if (
auto EC = Info->commit(Layout, Buffer))
133 if (
auto EC = Dbi->commit(Layout, Buffer))
138 if (
auto EC = Tpi->commit(Layout, Buffer))
143 if (
auto EC = Ipi->commit(Layout, Buffer))
void setOffset(uint32_t Off)
Error commit() const override
uint64_t blockToOffset(uint64_t BlockNumber, uint64_t BlockSize)
DbiStreamBuilder & getDbiBuilder()
Tagged union holding either a T or a Error.
TpiStreamBuilder & getIpiBuilder()
Error writeObject(const T &Obj)
Error commit(StringRef Filename)
Error initialize(uint32_t BlockSize)
Allocate memory in an ever growing pool, as if by bump-pointer.
Greedy Register Allocator
static ErrorOr< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
Error writeInteger(uint8_t Int)
static const int BlockSize
Error writeArray(ArrayRef< T > Array)
static ErrorSuccess success()
Create a success value.
InfoStreamBuilder & getInfoBuilder()
msf::MSFBuilder & getMsfBuilder()
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
TpiStreamBuilder & getTpiBuilder()