19void Block::addPointer(
Pointer *P) {
23 assert(!hasPointer(P));
26 Pointers->BS.Prev = P;
31 assert(hasPointer(P));
35void Block::removePointer(
Pointer *P) {
40 assert(hasPointer(P));
43 BlockPointer &BP = P->
BS;
54 assert(!hasPointer(P));
58void Block::cleanup() {
60 (
reinterpret_cast<DeadBlock *
>(
this + 1) - 1)->free();
67 assert(
New->isBlockPointer());
70 assert(hasPointer(Old));
73 BlockPointer &OldBP = Old->
BS;
74 BlockPointer &NewBP =
New->BS;
88 assert(!hasPointer(Old));
89 assert(hasPointer(
New));
94bool Block::hasPointer(
const Pointer *P)
const {
108 this->removePointer(P);
128 : Root(Root), B(~0u, Blk->Desc, Blk->MDSize, Blk->isExtern(), Blk->IsStatic,
139 B.DynAllocId = Blk->DynAllocId;
142 B.Pointers = Blk->Pointers;
145 Blk->Pointers =
nullptr;
148void DeadBlock::free() {
void movePointersTo(Block *B)
Move all pointers from this block to.
bool isInitialized() const
Returns whether the data of this block has been initialized via invoking the Ctor func.
Block(unsigned EvalID, UnsignedOrNone DeclID, const Descriptor *Desc, unsigned MDSize=0, bool IsStatic=false, bool IsExtern=false, bool IsWeak=false)
Creates a new block.
bool hasPointers() const
Checks if the block has any live pointers.
void removePointers()
Make all pointers that currently point to this block point to nullptr.
DeadBlock(DeadBlock *&Root, Block *Blk)
Copies the block.
A pointer to a memory block, live or dead.
bool isBlockPointer() const
const BlockPointer & asBlockPointer() const
Top level wrappers for InstallAPI frontend operations.
for(const auto &A :T->param_types())
Pointer * Prev
Previous link in the pointer chain.
Pointer * Next
Next link in the pointer chain.
Block * Pointee
The block the pointer is pointing to.