clang 19.0.0git
Public Member Functions | Friends | List of all members
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/Interp/InterpBlock.h"

Public Member Functions

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

Friends

class Pointer
 
class DeadBlock
 
class InterpState
 
class DynamicAllocator
 

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

Constructor & Destructor Documentation

◆ Block() [1/2]

clang::interp::Block::Block ( unsigned  EvalID,
const std::optional< unsigned > &  DeclID,
const Descriptor Desc,
bool  IsStatic = false,
bool  IsExtern = false 
)
inline

Creates a new block.

Definition at line 52 of file InterpBlock.h.

◆ Block() [2/2]

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

Definition at line 59 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 89 of file InterpBlock.h.

References clang::interp::Descriptor::getMetadataSize(), and rawData().

Referenced by clang::interp::DeadBlock::data(), clang::interp::InterpState::deallocate(), clang::interp::Pointer::elem(), invokeCtor(), and invokeDtor().

◆ data() [2/2]

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

Definition at line 94 of file InterpBlock.h.

References clang::interp::Descriptor::getMetadataSize(), and rawData().

◆ dump() [1/2]

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

Definition at line 127 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 325 of file Disasm.cpp.

References clang::interp::Descriptor::dump(), and P.

◆ getDeclID()

std::optional< unsigned > clang::interp::Block::getDeclID ( ) const
inline

Returns the declaration ID.

Definition at line 80 of file InterpBlock.h.

Referenced by clang::interp::Pointer::getDeclID().

◆ getDescriptor()

const Descriptor * clang::interp::Block::getDescriptor ( ) const
inline

◆ getEvalID()

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

The Evaluation ID this block was created in.

Definition at line 85 of file InterpBlock.h.

Referenced by clang::interp::CheckMutable().

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

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

◆ invokeCtor()

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

◆ invokeDtor()

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

◆ isDynamic()

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

Definition at line 76 of file InterpBlock.h.

◆ isExtern()

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

Checks if the block is extern.

Definition at line 71 of file InterpBlock.h.

Referenced by clang::interp::Pointer::isExtern().

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

Referenced by clang::interp::EvalEmitter::~EvalEmitter(), clang::interp::InterpFrame::~InterpFrame(), and clang::interp::Program::~Program().

◆ isStatic()

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

Checks if the block has static storage duration.

Definition at line 73 of file InterpBlock.h.

Referenced by clang::interp::Pointer::isStatic().

◆ isTemporary()

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

Checks if the block is temporary.

Definition at line 75 of file InterpBlock.h.

References clang::interp::Descriptor::IsTemporary.

Referenced by clang::interp::Pointer::isTemporary().

◆ rawData() [1/2]

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

◆ rawData() [2/2]

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

Definition at line 105 of file InterpBlock.h.

Friends And Related Function Documentation

◆ DeadBlock

friend class DeadBlock
friend

Definition at line 132 of file InterpBlock.h.

◆ DynamicAllocator

friend class DynamicAllocator
friend

Definition at line 134 of file InterpBlock.h.

◆ InterpState

friend class InterpState
friend

Definition at line 133 of file InterpBlock.h.

◆ Pointer

friend class Pointer
friend

Definition at line 131 of file InterpBlock.h.


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