clang  10.0.0svn
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
clang::interp::Block Class Reference

A memory block, either on the stack or in the heap. More...

#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/AST/Interp/Block.h"

Collaboration diagram for clang::interp::Block:
Collaboration graph
[legend]

Public Member Functions

 Block (const llvm::Optional< unsigned > &DeclID, Descriptor *Desc, bool IsStatic=false, bool IsExtern=false)
 
 Block (Descriptor *Desc, bool IsStatic=false, bool IsExtern=false)
 
DescriptorgetDescriptor () const
 Returns the block's descriptor. More...
 
bool hasPointers () const
 Checks if the block has any live pointers. More...
 
bool isExtern () const
 Checks if the block is extern. More...
 
bool isStatic () const
 Checks if the block has static storage duration. More...
 
bool isTemporary () const
 Checks if the block is temporary. More...
 
InterpSize getSize () const
 Returns the size of the block. More...
 
llvm::Optional< unsigned > getDeclID () const
 Returns the declaration ID. More...
 
char * data ()
 Returns a pointer to the stored data. More...
 
template<typename T >
T & deref ()
 Returns a view over the data. More...
 
void invokeCtor ()
 Invokes the constructor. More...
 

Protected Member Functions

 Block (Descriptor *Desc, bool IsExtern, bool IsStatic, bool IsDead)
 
void cleanup ()
 
void addPointer (Pointer *P)
 
void removePointer (Pointer *P)
 
void movePointer (Pointer *From, Pointer *To)
 

Protected Attributes

PointerPointers = nullptr
 Start of the chain of pointers. More...
 
llvm::Optional< unsigned > DeclID
 Unique identifier of the declaration. More...
 
bool IsStatic = false
 Flag indicating if the block has static storage duration. More...
 
bool IsExtern = false
 Flag indicating if the block is an extern. More...
 
bool IsDead = false
 Flag indicating if the pointer is dead. More...
 
DescriptorDesc
 Pointer to the stack slot descriptor. More...
 

Friends

class Pointer
 
class DeadBlock
 
class InterpState
 

Detailed Description

A memory block, either on the stack or in the heap.

The storage described by the block immediately follows it in memory.

Definition at line 37 of file Block.h.

Constructor & Destructor Documentation

◆ Block() [1/3]

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

Definition at line 40 of file Block.h.

◆ Block() [2/3]

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

Definition at line 44 of file Block.h.

◆ Block() [3/3]

clang::interp::Block::Block ( Descriptor Desc,
bool  IsExtern,
bool  IsStatic,
bool  IsDead 
)
inlineprotected

Definition at line 83 of file Block.h.

References addPointer(), cleanup(), movePointer(), P, and removePointer().

Member Function Documentation

◆ addPointer()

void Block::addPointer ( Pointer P)
protected

Definition at line 21 of file Block.cpp.

References IsStatic, P, and Pointers.

Referenced by Block(), clang::interp::Pointer::operator=(), and clang::interp::Pointer::Pointer().

◆ cleanup()

void Block::cleanup ( )
protected

Definition at line 42 of file Block.cpp.

References IsDead, and Pointers.

Referenced by Block(), clang::interp::Pointer::operator=(), and clang::interp::Pointer::~Pointer().

◆ data()

char* clang::interp::Block::data ( )
inline

Returns a pointer to the stored data.

Definition at line 64 of file Block.h.

Referenced by clang::interp::InterpState::deallocate(), deref(), clang::interp::Pointer::deref(), clang::interp::Pointer::elem(), and invokeCtor().

◆ deref()

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

Returns a view over the data.

Definition at line 68 of file Block.h.

References data().

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

◆ getDeclID()

llvm::Optional<unsigned> clang::interp::Block::getDeclID ( ) const
inline

Returns the declaration ID.

Definition at line 61 of file Block.h.

References DeclID.

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

◆ getDescriptor()

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

Returns the block's descriptor.

Definition at line 49 of file Block.h.

References Desc.

Referenced by clang::interp::InterpState::deallocate().

◆ getSize()

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

Returns the size of the block.

Definition at line 59 of file Block.h.

References Desc, and clang::interp::Descriptor::getAllocSize().

Referenced by clang::interp::InterpState::deallocate(), invokeCtor(), and clang::interp::Pointer::print().

◆ hasPointers()

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

Checks if the block has any live pointers.

Definition at line 51 of file Block.h.

References Pointers.

Referenced by clang::interp::InterpState::deallocate().

◆ invokeCtor()

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

◆ isExtern()

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

Checks if the block is extern.

Definition at line 53 of file Block.h.

References IsExtern.

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

◆ isStatic()

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

Checks if the block has static storage duration.

Definition at line 55 of file Block.h.

References IsStatic.

Referenced by ctorRecord(), and clang::interp::Pointer::isStatic().

◆ isTemporary()

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

Checks if the block is temporary.

Definition at line 57 of file Block.h.

References Desc, and clang::interp::Descriptor::IsTemporary.

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

◆ movePointer()

void Block::movePointer ( Pointer From,
Pointer To 
)
protected

Definition at line 47 of file Block.cpp.

References IsStatic, and Pointers.

Referenced by Block(), clang::interp::Pointer::operator=(), and clang::interp::Pointer::Pointer().

◆ removePointer()

void Block::removePointer ( Pointer P)
protected

Definition at line 31 of file Block.cpp.

References IsStatic, and Pointers.

Referenced by Block(), clang::interp::Pointer::operator=(), and clang::interp::Pointer::~Pointer().

Friends And Related Function Documentation

◆ DeadBlock

friend class DeadBlock
friend

Definition at line 80 of file Block.h.

◆ InterpState

friend class InterpState
friend

Definition at line 81 of file Block.h.

◆ Pointer

friend class Pointer
friend

Definition at line 79 of file Block.h.

Member Data Documentation

◆ DeclID

llvm::Optional<unsigned> clang::interp::Block::DeclID
protected

Unique identifier of the declaration.

Definition at line 97 of file Block.h.

Referenced by getDeclID().

◆ Desc

Descriptor* clang::interp::Block::Desc
protected

Pointer to the stack slot descriptor.

Definition at line 105 of file Block.h.

Referenced by ctorRecord(), clang::interp::Pointer::getDeclDesc(), getDescriptor(), getSize(), invokeCtor(), and isTemporary().

◆ IsDead

bool clang::interp::Block::IsDead = false
protected

Flag indicating if the pointer is dead.

Definition at line 103 of file Block.h.

Referenced by cleanup(), and clang::interp::Pointer::isLive().

◆ IsExtern

bool clang::interp::Block::IsExtern = false
protected

Flag indicating if the block is an extern.

Definition at line 101 of file Block.h.

Referenced by isExtern().

◆ IsStatic

bool clang::interp::Block::IsStatic = false
protected

Flag indicating if the block has static storage duration.

Definition at line 99 of file Block.h.

Referenced by addPointer(), clang::interp::Pointer::initialize(), clang::interp::Pointer::isInitialized(), isStatic(), movePointer(), and removePointer().

◆ Pointers

Pointer* clang::interp::Block::Pointers = nullptr
protected

Start of the chain of pointers.

Definition at line 95 of file Block.h.

Referenced by addPointer(), cleanup(), clang::interp::DeadBlock::DeadBlock(), hasPointers(), movePointer(), and removePointer().


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