clang 19.0.0git
|
A memory block, either on the stack or in the heap. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/Interp/InterpBlock.h"
Public Member Functions | |
Block (const std::optional< unsigned > &DeclID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false) | |
Creates a new block. | |
Block (const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false) | |
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 | isStatic () const |
Checks if the block has static storage duration. | |
bool | isTemporary () const |
Checks if the block is temporary. | |
unsigned | getSize () const |
Returns the size of the block. | |
std::optional< unsigned > | getDeclID () const |
Returns the declaration ID. | |
bool | isInitialized () const |
std::byte * | data () |
Returns a pointer to the stored data. | |
const std::byte * | data () const |
std::byte * | rawData () |
Returns a pointer to the raw data, including metadata. | |
const std::byte * | rawData () const |
template<typename T > | |
T & | deref () |
Returns a view over the data. | |
template<typename T > | |
const T & | deref () const |
void | invokeCtor () |
Invokes the constructor. | |
void | invokeDtor () |
Invokes the Destructor. | |
void | dump () const |
void | dump (llvm::raw_ostream &OS) const |
Protected Member Functions | |
Block (const Descriptor *Desc, bool IsExtern, bool IsStatic, bool IsDead) | |
void | cleanup () |
Deletes a dead block at the end of its lifetime. | |
void | addPointer (Pointer *P) |
Pointer chain management. | |
void | removePointer (Pointer *P) |
void | replacePointer (Pointer *Old, Pointer *New) |
bool | hasPointer (const Pointer *P) const |
Protected Attributes | |
Pointer * | Pointers = nullptr |
Start of the chain of pointers. | |
std::optional< unsigned > | DeclID |
Unique identifier of the declaration. | |
bool | IsStatic = false |
Flag indicating if the block has static storage duration. | |
bool | IsExtern = false |
Flag indicating if the block is an extern. | |
bool | IsDead = false |
Flag indicating if the pointer is dead. | |
bool | IsInitialized = false |
Flag indicating if the block contents have been initialized via invokeCtor. | |
const Descriptor * | Desc |
Pointer to the stack slot descriptor. | |
Friends | |
class | Pointer |
class | DeadBlock |
class | InterpState |
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) │ Desc->getMetadataSize() │ Desc->getSize() │ └───────────────┴─────────────────────────┴─────────────────┘
Desc->getAllocSize() describes the size after the Block, i.e. the data size and the metadata size.
Definition at line 49 of file InterpBlock.h.
|
inline |
Creates a new block.
Definition at line 52 of file InterpBlock.h.
|
inline |
Definition at line 56 of file InterpBlock.h.
|
inlineprotected |
Definition at line 129 of file InterpBlock.h.
|
protected |
Pointer chain management.
Definition at line 19 of file InterpBlock.cpp.
References hasPointer(), IsStatic, P, and Pointers.
Referenced by replacePointer().
|
protected |
Deletes a dead block at the end of its lifetime.
Definition at line 56 of file InterpBlock.cpp.
References IsDead, and Pointers.
Referenced by clang::interp::Pointer::operator=().
|
inline |
Returns a pointer to the stored data.
You are allowed to read Desc->getSize() bytes from this address.
Definition at line 78 of file InterpBlock.h.
References Desc, clang::interp::Descriptor::getMetadataSize(), and rawData().
Referenced by clang::interp::DeadBlock::data(), clang::interp::InterpState::deallocate(), deref(), clang::interp::Pointer::elem(), invokeCtor(), and invokeDtor().
|
inline |
Definition at line 83 of file InterpBlock.h.
References Desc, clang::interp::Descriptor::getMetadataSize(), and rawData().
Returns a view over the data.
Definition at line 100 of file InterpBlock.h.
Definition at line 101 of file InterpBlock.h.
|
inline |
LLVM_DUMP_METHOD void Block::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 268 of file Disasm.cpp.
References IsDead, IsExtern, IsInitialized, IsStatic, P, and Pointers.
|
inline |
Returns the declaration ID.
Definition at line 73 of file InterpBlock.h.
References DeclID.
Referenced by clang::interp::Pointer::getDeclID().
|
inline |
Returns the block's descriptor.
Definition at line 61 of file InterpBlock.h.
References Desc.
Referenced by clang::interp::InterpState::deallocate().
|
inline |
Returns the size of the block.
Definition at line 71 of file InterpBlock.h.
References Desc, and clang::interp::Descriptor::getAllocSize().
Referenced by clang::interp::InterpState::deallocate().
Definition at line 85 of file InterpBlock.cpp.
References clang::C, P, and Pointers.
Referenced by addPointer(), removePointer(), and replacePointer().
|
inline |
Checks if the block has any live pointers.
Definition at line 63 of file InterpBlock.h.
References Pointers.
Referenced by clang::interp::InterpState::deallocate().
|
inline |
Invokes the constructor.
Definition at line 106 of file InterpBlock.h.
References clang::interp::Descriptor::CtorFn, data(), Desc, clang::interp::Descriptor::getAllocSize(), clang::interp::Descriptor::IsConst, IsInitialized, clang::interp::Descriptor::IsMutable, and rawData().
Referenced by clang::interp::EvalEmitter::createLocal(), and clang::interp::InterpFrame::InterpFrame().
|
inline |
Invokes the Destructor.
Definition at line 115 of file InterpBlock.h.
References data(), Desc, clang::interp::Descriptor::DtorFn, and IsInitialized.
Referenced by clang::interp::InterpState::deallocate(), clang::interp::EvalEmitter::~EvalEmitter(), and clang::interp::InterpFrame::~InterpFrame().
|
inline |
Checks if the block is extern.
Definition at line 65 of file InterpBlock.h.
References IsExtern.
Referenced by clang::interp::Pointer::isExtern().
|
inline |
Definition at line 74 of file InterpBlock.h.
References IsInitialized.
Referenced by clang::interp::EvalEmitter::~EvalEmitter(), and clang::interp::InterpFrame::~InterpFrame().
|
inline |
Checks if the block has static storage duration.
Definition at line 67 of file InterpBlock.h.
References IsStatic.
Referenced by clang::interp::Pointer::isStatic().
|
inline |
Checks if the block is temporary.
Definition at line 69 of file InterpBlock.h.
References Desc, and clang::interp::Descriptor::IsTemporary.
Referenced by clang::interp::Pointer::isTemporary().
|
inline |
Returns a pointer to the raw data, including metadata.
You are allowed to read Desc->getAllocSize() bytes from this address.
Definition at line 91 of file InterpBlock.h.
Referenced by data(), clang::interp::InterpState::deallocate(), clang::interp::Pointer::deref(), invokeCtor(), and clang::interp::DeadBlock::rawData().
|
inline |
Definition at line 94 of file InterpBlock.h.
|
protected |
Definition at line 36 of file InterpBlock.cpp.
References hasPointer(), IsStatic, P, and Pointers.
Referenced by replacePointer().
Definition at line 61 of file InterpBlock.cpp.
References addPointer(), clang::interp::Pointer::BS, hasPointer(), IsStatic, clang::interp::BlockPointer::Pointee, Pointers, and removePointer().
|
friend |
Definition at line 126 of file InterpBlock.h.
|
friend |
Definition at line 127 of file InterpBlock.h.
|
friend |
Definition at line 125 of file InterpBlock.h.
|
protected |
Unique identifier of the declaration.
Definition at line 146 of file InterpBlock.h.
Referenced by getDeclID().
|
protected |
Pointer to the stack slot descriptor.
Definition at line 158 of file InterpBlock.h.
Referenced by ctorRecord(), data(), clang::interp::Pointer::getDeclDesc(), getDescriptor(), getSize(), invokeCtor(), invokeDtor(), and isTemporary().
Flag indicating if the pointer is dead.
This is only ever set once, when converting the Block to a DeadBlock.
Definition at line 153 of file InterpBlock.h.
Referenced by cleanup(), dump(), and clang::interp::Pointer::isLive().
Flag indicating if the block is an extern.
Definition at line 150 of file InterpBlock.h.
Referenced by dump(), and isExtern().
Flag indicating if the block contents have been initialized via invokeCtor.
Definition at line 156 of file InterpBlock.h.
Referenced by clang::interp::InterpState::deallocate(), dump(), invokeCtor(), invokeDtor(), and isInitialized().
Flag indicating if the block has static storage duration.
Definition at line 148 of file InterpBlock.h.
Referenced by addPointer(), dump(), isStatic(), removePointer(), and replacePointer().
|
protected |
Start of the chain of pointers.
Definition at line 144 of file InterpBlock.h.
Referenced by addPointer(), cleanup(), clang::interp::DeadBlock::DeadBlock(), dump(), hasPointer(), hasPointers(), removePointer(), and replacePointer().