#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/MSF/MSFError.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/TimeProfiler.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
#include <vector>
usingnamespacellvm;
usingnamespacellvm::msf;
usingnamespacellvm::support;
static const uint32_t kSuperBlockBlock = …;
static const uint32_t kFreePageMap0Block = …;
static const uint32_t kFreePageMap1Block = …;
static const uint32_t kNumReservedPages = …;
static const uint32_t kDefaultFreePageMap = …;
static const uint32_t kDefaultBlockMapAddr = …;
MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
BumpPtrAllocator &Allocator)
: … { … }
Expected<MSFBuilder> MSFBuilder::create(BumpPtrAllocator &Allocator,
uint32_t BlockSize,
uint32_t MinBlockCount, bool CanGrow) { … }
Error MSFBuilder::setBlockMapAddr(uint32_t Addr) { … }
void MSFBuilder::setFreePageMap(uint32_t Fpm) { … }
void MSFBuilder::setUnknown1(uint32_t Unk1) { … }
Error MSFBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) { … }
Error MSFBuilder::allocateBlocks(uint32_t NumBlocks,
MutableArrayRef<uint32_t> Blocks) { … }
uint32_t MSFBuilder::getNumUsedBlocks() const { … }
uint32_t MSFBuilder::getNumFreeBlocks() const { … }
uint32_t MSFBuilder::getTotalBlockCount() const { … }
bool MSFBuilder::isBlockFree(uint32_t Idx) const { … }
Expected<uint32_t> MSFBuilder::addStream(uint32_t Size,
ArrayRef<uint32_t> Blocks) { … }
Expected<uint32_t> MSFBuilder::addStream(uint32_t Size) { … }
Error MSFBuilder::setStreamSize(uint32_t Idx, uint32_t Size) { … }
uint32_t MSFBuilder::getNumStreams() const { … }
uint32_t MSFBuilder::getStreamSize(uint32_t StreamIdx) const { … }
ArrayRef<uint32_t> MSFBuilder::getStreamBlocks(uint32_t StreamIdx) const { … }
uint32_t MSFBuilder::computeDirectoryByteSize() const { … }
Expected<MSFLayout> MSFBuilder::generateLayout() { … }
static void commitFpm(WritableBinaryStream &MsfBuffer, const MSFLayout &Layout,
BumpPtrAllocator &Allocator) { … }
Expected<FileBufferByteStream> MSFBuilder::commit(StringRef Path,
MSFLayout &Layout) { … }