|
clang 24.0.0git
|
A memory block, either on the stack or in the heap. More...
#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/Block.h"
Public Types | |
| enum | BlockKind : uint8_t { None , Local , Global } |
Public Member Functions | |
| Block (unsigned EvalID, UnsignedOrNone DeclID, const Descriptor *Desc, BlockKind K, BlockFlags Flags=BlockFlags::empty()) | |
| Block (unsigned EvalID, const Descriptor *Desc, BlockKind K, BlockFlags Flags=BlockFlags::empty()) | |
| bool | isGlobal () const |
| bool | isLocal () const |
| const Descriptor * | getDescriptor () const |
| Returns the block's descriptor. | |
| bool | hasPointers () const |
| Checks if the block has any live pointers. | |
| bool | isExtern () const |
| Checks if the block is extern. | |
| bool | isTemporary () const |
| Checks if the block is temporary. | |
| bool | isWeak () const |
| bool | isDynamic () const |
| bool | isDead () const |
| bool | isConstexprUnknown () const |
| bool | isAccessible () const |
| unsigned | getSize () const |
| Returns the size of the block, excluding metadata. | |
| unsigned | getAllocSize () const |
| Returns the size of the block, including metadata. | |
| UnsignedOrNone | getDeclID () const |
| Returns the declaration ID. | |
| bool | isInitialized () const |
| Returns whether the data of this block has been initialized via invoking the Ctor func. | |
| unsigned | getEvalID () const |
| The Evaluation ID this block was created in. | |
| void | movePointersTo (Block *B) |
| Move all pointers from this block to. | |
| void | removePointers () |
| Make all pointers that currently point to this block point to nullptr. | |
| std::byte * | data () |
| Returns a pointer to the stored data. | |
| const std::byte * | data () const |
| template<typename T> | |
| const T & | deref () const |
| template<typename T> | |
| T & | deref () |
| template<typename T> | |
| T & | getBlockDesc () |
| template<typename T> | |
| const T & | getBlockDesc () const |
| void | invokeCtor () |
| Invokes the constructor. | |
| void | invokeCtorNoMemset () |
| The same, but won't memset() the memory first to zero. | |
| void | invokeDtor () |
| Invokes the Destructor. | |
| void | dump () const |
| void | dump (llvm::raw_ostream &OS) const |
Static Public Member Functions | |
| static unsigned | allocSize (const Descriptor *D, BlockKind K) |
| Number of bytes needed to allocate the block. | |
| static unsigned | getMetadataSize (BlockKind K) |
Friends | |
| class | Pointer |
| class | DeadBlock |
| class | InterpState |
| class | DynamicAllocator |
| class | Program |
A memory block, either on the stack or in the heap.
The storage described by the block is immediately followed by optional metadata, which is followed by the actual data.
Block* rawData() data() │ │ │ │ │ │ ▼ ▼ ▼ ┌───────────────┬──────────────────┬─────────────────┐ │ Block │ Metadata │ Data │ │ sizeof(Block) │ MDSize │ Desc->getSize() │ └───────────────┴──────────────────┴─────────────────┘
getSize() returns Desc->getAllocSize(). getAllocSize() returns getMetadataSize() + Desc->getAllocSize().
|
inline |
Definition at line 72 of file Block.h.
References clang::interp::BlockFlags::empty(), getAllocSize(), and getMetadataSize().
Referenced by allocSize(), getBlockDesc(), and movePointersTo().
|
inline |
Definition at line 77 of file Block.h.
References clang::interp::BlockFlags::empty(), getAllocSize(), and getMetadataSize().
|
inlinestatic |
Number of bytes needed to allocate the block.
Definition at line 83 of file Block.h.
References Block(), clang::interp::Descriptor::getAllocSize(), and getMetadataSize().
Referenced by clang::interp::DynamicAllocator::allocate(), and clang::interp::EvalEmitter::createLocal().
|
inline |
Returns a pointer to the stored data.
You are allowed to read Desc->getSize() bytes from this address.
Definition at line 140 of file Block.h.
Referenced by deref(), deref(), clang::interp::InterpFrame::getParamPointer(), invokeCtorNoMemset(), and invokeDtor().
|
inline |
Definition at line 143 of file Block.h.
References data(), and clang::T.
Referenced by clang::interp::GetGlobal(), clang::interp::GetGlobalUnchecked(), clang::interp::GetLocal(), clang::interp::InterpFrame::getParam(), clang::interp::GetRefGlobal(), clang::interp::handleReference(), and clang::interp::InterpFrame::setLocal().
|
inline |
| LLVM_DUMP_METHOD void Block::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 607 of file Disasm.cpp.
References isDead(), isDynamic(), isExtern(), isWeak(), Next, and Pointer.
|
inline |
Returns the size of the block, including metadata.
Definition at line 125 of file Block.h.
Referenced by Block(), Block(), and invokeCtor().
Definition at line 148 of file Block.h.
References getMetadataSize(), Global, Local, None, and clang::T.
Referenced by clang::interp::Pointer::allElementsAlive(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLocalLoad(), clang::interp::Destroy(), clang::interp::InterpFrame::enableLocal(), getBlockDesc(), clang::interp::GetGlobalUnchecked(), clang::interp::Program::getPtrGlobal(), clang::interp::GetRefGlobal(), clang::interp::handleReference(), clang::interp::InterpFrame::isLocalEnabled(), clang::interp::InterpFrame::setLocal(), clang::interp::Compiler< Emitter >::visitDecl(), and clang::interp::Compiler< Emitter >::visitDeclAndReturn().
Definition at line 160 of file Block.h.
References Block(), getBlockDesc(), and clang::T.
|
inline |
Returns the declaration ID.
Definition at line 127 of file Block.h.
Referenced by CheckGlobal(), and clang::interp::CheckTemporary().
|
inline |
Returns the block's descriptor.
Definition at line 103 of file Block.h.
Referenced by clang::interp::CheckGlobalLoad(), clang::interp::CheckLocalLoad(), clang::interp::CheckTemporary(), clang::interp::CheckWeak(), clang::interp::diagnoseUninitialized(), clang::interp::Free(), clang::interp::InterpFrame::getParamPointer(), clang::interp::Program::getPtrGlobal(), clang::interp::GetRefGlobal(), clang::interp::handleReference(), clang::interp::Pointer::hasSameBase(), clang::interp::interp__builtin_operator_delete(), clang::interp::InterpState::lifetimeStartedInEvaluation(), clang::interp::noteValueLocation(), clang::interp::RunDestructors(), and clang::interp::Integral< Bits, false >::toAPValue().
|
inline |
The Evaluation ID this block was created in.
Definition at line 132 of file Block.h.
Referenced by clang::interp::CheckTemporary(), and clang::interp::InterpState::lifetimeStartedInEvaluation().
Definition at line 87 of file Block.h.
References Global, Local, and None.
Referenced by allocSize(), Block(), Block(), clang::interp::ByteCodeEmitter::createLocal(), and getBlockDesc().
|
inline |
Returns the size of the block, excluding metadata.
Definition at line 123 of file Block.h.
Referenced by clang::interp::Pointer::print(), and clang::interp::MemberPointer::toPointer().
|
inline |
Checks if the block has any live pointers.
Definition at line 105 of file Block.h.
Referenced by clang::interp::DynamicAllocator::deallocate(), clang::interp::InterpState::deallocate(), and movePointersTo().
|
inline |
Invokes the constructor.
Definition at line 165 of file Block.h.
References getAllocSize(), and invokeCtorNoMemset().
Referenced by clang::interp::InterpFrame::getLocalBlock(), and clang::interp::InterpFrame::getParamPointer().
|
inline |
The same, but won't memset() the memory first to zero.
Definition at line 171 of file Block.h.
References data().
Referenced by invokeCtor().
|
inline |
Invokes the Destructor.
Definition at line 181 of file Block.h.
References data().
Referenced by clang::interp::DynamicAllocator::cleanup(), clang::interp::Program::createGlobal(), clang::interp::DynamicAllocator::deallocate(), clang::interp::InterpState::deallocate(), clang::interp::Compiler< Emitter >::visitDecl(), and clang::interp::Compiler< Emitter >::visitDeclAndReturn().
|
inline |
Definition at line 121 of file Block.h.
Referenced by clang::interp::CheckGlobalLoad(), and clang::interp::CheckStore().
|
inline |
Definition at line 118 of file Block.h.
References clang::interp::BlockFlags::ConstexprUnknown.
Referenced by clang::interp::GetRefGlobal(), and clang::interp::handleReference().
|
inline |
Definition at line 117 of file Block.h.
References clang::interp::BlockFlags::Dead.
Referenced by clang::interp::DynamicAllocator::cleanup(), clang::interp::DynamicAllocator::deallocate(), and dump().
|
inline |
Definition at line 111 of file Block.h.
References clang::Result.
Referenced by dump(), clang::interp::interp__builtin_operator_delete(), and clang::interp::noteValueLocation().
|
inline |
Checks if the block is extern.
Definition at line 107 of file Block.h.
References clang::interp::BlockFlags::Extern.
Referenced by clang::interp::CheckExtern(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLocalLoad(), dump(), clang::interp::GetGlobalUnchecked(), and clang::interp::GetRefGlobal().
|
inline |
Definition at line 99 of file Block.h.
References Global.
Referenced by CheckGlobal(), clang::interp::CheckTemporary(), clang::interp::getDynamicDecl(), and clang::interp::Program::getPtrGlobal().
|
inline |
Returns whether the data of this block has been initialized via invoking the Ctor func.
Definition at line 130 of file Block.h.
Referenced by clang::interp::DynamicAllocator::cleanup(), clang::interp::DynamicAllocator::deallocate(), clang::interp::Destroy(), clang::interp::InterpFrame::destroy(), clang::interp::InterpFrame::getLocalBlock(), clang::interp::InterpFrame::getParam(), clang::interp::InterpFrame::getParamPointer(), and clang::interp::InterpFrame::~InterpFrame().
|
inline |
|
inline |
Checks if the block is temporary.
Definition at line 109 of file Block.h.
Referenced by clang::interp::CheckTemporary(), and clang::interp::noteValueLocation().
|
inline |
Definition at line 110 of file Block.h.
References clang::interp::BlockFlags::Weak.
Referenced by clang::interp::CheckWeak(), and dump().
| void Block::movePointersTo | ( | Block * | B | ) |
Move all pointers from this block to.
| B. |
Definition at line 103 of file Block.cpp.
References Block(), clang::interp::Pointer::BS, hasPointers(), clang::interp::BlockPointer::Pointee, and Pointer.
Referenced by clang::interp::Program::createGlobal().
| void Block::removePointers | ( | ) |
Make all pointers that currently point to this block point to nullptr.
Definition at line 115 of file Block.cpp.
References clang::interp::Pointer::BS, clang::interp::BlockPointer::Next, Next, clang::interp::BlockPointer::Pointee, Pointer, and clang::interp::BlockPointer::Prev.
Referenced by clang::interp::DynamicAllocator::cleanup().
|
friend |
|
friend |
Definition at line 195 of file Block.h.
References DynamicAllocator.
Referenced by DynamicAllocator.
|
friend |
|
friend |
Definition at line 192 of file Block.h.
References Pointer.
Referenced by dump(), movePointersTo(), Pointer, and removePointers().
|
friend |