#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <utility>
#include <vector>
usingnamespacellvm;
usingnamespacellvm::msf;
namespace {
template <typename Base> class MappedBlockStreamImpl : public Base { … };
}
Interval;
static Interval intersect(const Interval &I1, const Interval &I2) { … }
MappedBlockStream::MappedBlockStream(uint32_t BlockSize,
const MSFStreamLayout &Layout,
BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator)
: … { … }
std::unique_ptr<MappedBlockStream> MappedBlockStream::createStream(
uint32_t BlockSize, const MSFStreamLayout &Layout, BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<MappedBlockStream> MappedBlockStream::createIndexedStream(
const MSFLayout &Layout, BinaryStreamRef MsfData, uint32_t StreamIndex,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<MappedBlockStream>
MappedBlockStream::createDirectoryStream(const MSFLayout &Layout,
BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<MappedBlockStream>
MappedBlockStream::createFpmStream(const MSFLayout &Layout,
BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator) { … }
Error MappedBlockStream::readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) { … }
Error MappedBlockStream::readLongestContiguousChunk(uint64_t Offset,
ArrayRef<uint8_t> &Buffer) { … }
uint64_t MappedBlockStream::getLength() { … }
bool MappedBlockStream::tryReadContiguously(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) { … }
Error MappedBlockStream::readBytes(uint64_t Offset,
MutableArrayRef<uint8_t> Buffer) { … }
void MappedBlockStream::invalidateCache() { … }
void MappedBlockStream::fixCacheAfterWrite(uint64_t Offset,
ArrayRef<uint8_t> Data) const { … }
WritableMappedBlockStream::WritableMappedBlockStream(
uint32_t BlockSize, const MSFStreamLayout &Layout,
WritableBinaryStreamRef MsfData, BumpPtrAllocator &Allocator)
: … { … }
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createStream(uint32_t BlockSize,
const MSFStreamLayout &Layout,
WritableBinaryStreamRef MsfData,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createIndexedStream(const MSFLayout &Layout,
WritableBinaryStreamRef MsfData,
uint32_t StreamIndex,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createDirectoryStream(
const MSFLayout &Layout, WritableBinaryStreamRef MsfData,
BumpPtrAllocator &Allocator) { … }
std::unique_ptr<WritableMappedBlockStream>
WritableMappedBlockStream::createFpmStream(const MSFLayout &Layout,
WritableBinaryStreamRef MsfData,
BumpPtrAllocator &Allocator,
bool AltFpm) { … }
Error WritableMappedBlockStream::readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) { … }
Error WritableMappedBlockStream::readLongestContiguousChunk(
uint64_t Offset, ArrayRef<uint8_t> &Buffer) { … }
uint64_t WritableMappedBlockStream::getLength() { … }
Error WritableMappedBlockStream::writeBytes(uint64_t Offset,
ArrayRef<uint8_t> Buffer) { … }
Error WritableMappedBlockStream::commit() { … }