15#ifndef LLVM_CAS_MAPPEDFILEREGIONARENA_H
16#define LLVM_CAS_MAPPEDFILEREGIONARENA_H
71 struct alignas(8)
T {};
72 static_assert(
alignof(
T) == 8,
"Tautology failed?");
86 char *
data()
const {
return Region.data(); }
107 void initializeHeader(
uint64_t HeaderOffset);
123 std::optional<int> FD;
125 std::optional<int> SharedLockFD;
#define LLVM_UNLIKELY(EXPR)
Tagged union holding either a T or a Error.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
MappedFileRegionArena()=default
uint64_t capacity() const
MappedFileRegionArena & operator=(MappedFileRegionArena &&RHS)
MappedFileRegionArena(const MappedFileRegionArena &)=delete
Expected< int64_t > allocateOffset(uint64_t AllocSize)
Allocate, returning the offset from data() instead of a pointer.
MappedFileRegionArena(MappedFileRegionArena &&RHS)
Expected< char * > allocate(uint64_t AllocSize)
Allocate at least AllocSize. Rounds up to getAlign().
static Expected< MappedFileRegionArena > create(const Twine &Path, uint64_t Capacity, uint64_t HeaderOffset, function_ref< Error(MappedFileRegionArena &)> NewFileConstructor)
Create a MappedFileRegionArena.
static constexpr Align getAlign()
Minimum alignment for allocations, currently hardcoded to 8B.
sys::fs::mapped_file_region RegionT
MappedFileRegionArena & operator=(const MappedFileRegionArena &)=delete
An efficient, type-erasing, non-owning reference to a callable.
This class represents a memory mapped file.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static constexpr Align Of()
Allow constructions of constexpr Align from types.