| //===--- Block.cpp - Allocated blocks for the interpreter -------*- C++ -*-===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // Defines the classes describing allocated blocks. |
| //===----------------------------------------------------------------------===// |
| using namespace clang::interp; |
| void Block::addPointer(Pointer *P) { |
| void Block::removePointer(Pointer *P) { |
| if (Pointers == nullptr && IsDead) |
| (reinterpret_cast<DeadBlock *>(this + 1) - 1)->free(); |
| void Block::movePointer(Pointer *From, Pointer *To) { |
| DeadBlock::DeadBlock(DeadBlock *&Root, Block *Blk) |
| : Root(Root), B(Blk->Desc, Blk->IsStatic, Blk->IsExtern, /*isDead=*/true) { |
| // Add the block to the chain of dead blocks. |
| B.Pointers = Blk->Pointers; |
| for (Pointer *P = Blk->Pointers; P; P = P->Next) |