32 using namespace llvm::msf;
33 using namespace llvm::pdb;
34 using namespace llvm::support;
37 : Msf(Msf),
Allocator(Msf.getAllocator()), Header(nullptr), Idx(StreamIdx) {
47 TypeRecords.push_back(Record);
48 TypeRecordStream.
setItems(TypeRecords);
51 Error TpiStreamBuilder::finalize() {
58 uint32_t HashBufferSize = calculateHashBufferSize();
89 uint32_t TpiStreamBuilder::calculateHashBufferSize()
const {
90 if (TypeRecords.empty() || !TypeRecords[0].Hash.hasValue())
100 uint32_t HashBufferSize = calculateHashBufferSize();
102 if (HashBufferSize == 0)
105 auto ExpectedIndex = Msf.
addStream(HashBufferSize);
107 return ExpectedIndex.takeError();
108 HashStreamIndex = *ExpectedIndex;
111 for (
uint32_t I = 0;
I < TypeRecords.size(); ++
I) {
116 HashValueStream = llvm::make_unique<ByteStream>(Bytes);
122 if (
auto EC = finalize())
126 WritableMappedBlockStream::createIndexedStream(Layout, Buffer, Idx);
137 auto HVS = WritableMappedBlockStream::createIndexedStream(Layout, Buffer,
uint32_t getLength() const override
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
uint32_t calculateSerializedLength() const
Error writeStreamRef(ReadableStreamRef Ref)
Error writeObject(const T &Obj)
void addTypeRecord(const codeview::CVType &Record)
static const uint32_t FirstNonSimpleIndex
const uint16_t kInvalidStreamIndex
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Greedy Register Allocator
Error setStreamSize(uint32_t Idx, uint32_t Size)
Update the size of an existing stream.
Error writeArray(ArrayRef< T > Array)
const uint32_t MinTpiHashBuckets
static ErrorSuccess success()
Create a success value.
Expected< uint32_t > addStream(uint32_t Size, ArrayRef< uint32_t > Blocks)
Add a stream to the MSF file with the given size, occupying the given list of blocks.
void setVersionHeader(PdbRaw_TpiVer Version)
Error finalizeMsfLayout()
void setItems(ArrayRef< T > ItemArray)
Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer)
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Lightweight error class with error context and mandatory checking.