clang 22.0.0git
clang::interp::Block Class Referencefinal

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/ByteCode/InterpBlock.h"

Public Member Functions

 Block (unsigned EvalID, UnsignedOrNone DeclID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false, bool IsWeak=false, bool IsDummy=false)
 Creates a new block.
 Block (unsigned EvalID, const Descriptor *Desc, bool IsStatic=false, bool IsExtern=false, bool IsWeak=false, bool IsDummy=false)
const DescriptorgetDescriptor () 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.
bool isWeak () const
bool isDynamic () const
bool isDummy () const
bool isDead () const
unsigned getSize () const
 Returns the size of the block.
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.
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 () const
void invokeCtor ()
 Invokes the constructor.
void invokeDtor ()
 Invokes the Destructor.
void dump () const
void dump (llvm::raw_ostream &OS) const
bool isAccessible () const

Friends

class Pointer
class DeadBlock
class InterpState
class DynamicAllocator
class Program

Detailed Description

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 44 of file InterpBlock.h.

Constructor & Destructor Documentation

◆ Block() [1/2]

clang::interp::Block::Block ( unsigned EvalID,
UnsignedOrNone DeclID,
const Descriptor * Desc,
bool IsStatic = false,
bool IsExtern = false,
bool IsWeak = false,
bool IsDummy = false )
inline

Creates a new block.

Definition at line 53 of file InterpBlock.h.

Referenced by rawData(), and rawData().

◆ Block() [2/2]

clang::interp::Block::Block ( unsigned EvalID,
const Descriptor * Desc,
bool IsStatic = false,
bool IsExtern = false,
bool IsWeak = false,
bool IsDummy = false )
inline

Definition at line 63 of file InterpBlock.h.

Member Function Documentation

◆ data() [1/2]

std::byte * clang::interp::Block::data ( )
inline

Returns a pointer to the stored data.

You are allowed to read Desc->getSize() bytes from this address.

Definition at line 98 of file InterpBlock.h.

References rawData().

Referenced by deref(), invokeCtor(), and invokeDtor().

◆ data() [2/2]

const std::byte * clang::interp::Block::data ( ) const
inline

Definition at line 103 of file InterpBlock.h.

References rawData().

◆ deref()

template<typename T>
T clang::interp::Block::deref ( ) const
inline

◆ dump() [1/2]

void clang::interp::Block::dump ( ) const
inline

Definition at line 142 of file InterpBlock.h.

References dump().

Referenced by dump().

◆ dump() [2/2]

LLVM_DUMP_METHOD void Block::dump ( llvm::raw_ostream & OS) const

Definition at line 536 of file Disasm.cpp.

References isDead(), isDummy(), isDynamic(), isExtern(), isWeak(), Next, and Pointer.

◆ getDeclID()

UnsignedOrNone clang::interp::Block::getDeclID ( ) const
inline

Returns the declaration ID.

Definition at line 89 of file InterpBlock.h.

Referenced by CheckTemporary().

◆ getDescriptor()

◆ getEvalID()

unsigned clang::interp::Block::getEvalID ( ) const
inline

The Evaluation ID this block was created in.

Definition at line 94 of file InterpBlock.h.

Referenced by clang::interp::CheckMutable(), and CheckTemporary().

◆ getSize()

unsigned clang::interp::Block::getSize ( ) const
inline

◆ hasPointers()

bool clang::interp::Block::hasPointers ( ) const
inline

Checks if the block has any live pointers.

Definition at line 75 of file InterpBlock.h.

Referenced by clang::interp::DynamicAllocator::cleanup(), clang::interp::DynamicAllocator::deallocate(), and clang::interp::InterpState::deallocate().

◆ invokeCtor()

void clang::interp::Block::invokeCtor ( )
inline

Invokes the constructor.

Definition at line 123 of file InterpBlock.h.

References data(), and rawData().

◆ invokeDtor()

◆ isAccessible()

◆ isDead()

bool clang::interp::Block::isDead ( ) const
inline

◆ isDummy()

bool clang::interp::Block::isDummy ( ) const
inline

Definition at line 84 of file InterpBlock.h.

Referenced by clang::interp::CheckDummy(), and dump().

◆ isDynamic()

bool clang::interp::Block::isDynamic ( ) const
inline

◆ isExtern()

bool clang::interp::Block::isExtern ( ) const
inline

◆ isInitialized()

bool clang::interp::Block::isInitialized ( ) const
inline

Returns whether the data of this block has been initialized via invoking the Ctor func.

Definition at line 92 of file InterpBlock.h.

Referenced by clang::interp::DynamicAllocator::cleanup(), clang::interp::DynamicAllocator::deallocate(), clang::interp::InterpState::deallocate(), clang::interp::EvalEmitter::~EvalEmitter(), and clang::interp::Program::~Program().

◆ isStatic()

bool clang::interp::Block::isStatic ( ) const
inline

Checks if the block has static storage duration.

Definition at line 79 of file InterpBlock.h.

Referenced by clang::interp::CheckDestructor(), CheckTemporary(), and clang::interp::InterpState::deallocate().

◆ isTemporary()

bool clang::interp::Block::isTemporary ( ) const
inline

Checks if the block is temporary.

Definition at line 81 of file InterpBlock.h.

Referenced by CheckTemporary().

◆ isWeak()

bool clang::interp::Block::isWeak ( ) const
inline

Definition at line 82 of file InterpBlock.h.

Referenced by clang::interp::CheckWeak(), and dump().

◆ rawData() [1/2]

◆ rawData() [2/2]

const std::byte * clang::interp::Block::rawData ( ) const
inline

Definition at line 114 of file InterpBlock.h.

References Block().

◆ DeadBlock

friend class DeadBlock
friend

Definition at line 149 of file InterpBlock.h.

References DeadBlock.

Referenced by DeadBlock.

◆ DynamicAllocator

friend class DynamicAllocator
friend

Definition at line 151 of file InterpBlock.h.

References DynamicAllocator.

Referenced by DynamicAllocator.

◆ InterpState

friend class InterpState
friend

Definition at line 150 of file InterpBlock.h.

References InterpState.

Referenced by InterpState.

◆ Pointer

friend class Pointer
friend

Definition at line 148 of file InterpBlock.h.

References Pointer.

Referenced by dump(), and Pointer.

◆ Program

friend class Program
friend

Definition at line 152 of file InterpBlock.h.

References Program.

Referenced by Program.


The documentation for this class was generated from the following files: