clang 23.0.0git
clang::interp::InterpFrame Class Referencefinal

Frame storing local variables. More...

#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/InterpFrame.h"

Inheritance diagram for clang::interp::InterpFrame:
[legend]

Public Member Functions

 InterpFrame (InterpState &S)
 Bottom Frame.
 InterpFrame (InterpState &S, const Function *Func, InterpFrame *Caller, CodePtr RetPC, unsigned ArgSize)
 Creates a new frame for a method call.
 InterpFrame (InterpState &S, const Function *Func, CodePtr RetPC, unsigned VarArgSize=0)
 Creates a new frame with the values that make sense.
 ~InterpFrame ()
 Destroys the frame, killing all live pointers to stack slots.
std::string getName () const
void destroy (unsigned Idx)
 Invokes the destructors for a scope.
void initScope (unsigned Idx)
void destroyScopes ()
void enableLocal (unsigned Idx)
bool isLocalEnabled (unsigned Idx) const
void describe (llvm::raw_ostream &OS) const override
 Describes the frame with arguments for diagnostic purposes.
FramegetCaller () const override
 Returns the parent frame object.
SourceRange getCallRange () const override
 Returns the location of the call to the frame.
const FunctionDeclgetCallee () const override
 Returns the caller.
const FunctiongetFunction () const
 Returns the current function.
size_t getFrameOffset () const
 Returns the offset on the stack at which the frame starts.
template<typename T>
const T & getLocal (unsigned Offset) const
 Returns the value of a local variable.
template<typename T>
void setLocal (unsigned Offset, const T &Value)
 Mutates a local variable.
Pointer getLocalPointer (unsigned Offset) const
 Returns a pointer to a local variables.
BlockgetLocalBlock (unsigned Offset) const
template<typename T>
const T & getParam (unsigned Index) const
 Returns the value of an argument.
template<typename T>
void setParam (unsigned Index, const T &Value)
 Mutates a local copy of a parameter.
Pointer getParamPointer (unsigned Offset)
 Returns a pointer to an argument - lazily creates a block.
bool hasThisPointer () const
const PointergetThis () const
 Returns the 'this' pointer.
const PointergetRVOPtr () const
 Returns the RVO pointer, if the Function has one.
bool isRoot () const
 Checks if the frame is a root frame - return should quit the interpreter.
CodePtr getPC () const
 Returns the PC of the frame's code start.
CodePtr getRetPC () const
 Returns the return address of the frame.
SourceInfo getSource (CodePtr PC) const
 Map a location to a source.
const ExprgetExpr (CodePtr PC) const
SourceLocation getLocation (CodePtr PC) const
SourceRange getRange (CodePtr PC) const
unsigned getDepth () const
bool isStdFunction () const
bool isBottomFrame () const
void dump () const
void dump (llvm::raw_ostream &OS, unsigned Indent=0) const
Public Member Functions inherited from clang::interp::Frame
virtual ~Frame ()=default

Static Public Member Functions

static size_t allocSize (const Function *F)
 Returns the number of bytes needed to allocate an InterpFrame for the given function.
static void free (InterpFrame *F)

Public Attributes

InterpFrameCaller
 The frame of the previous function.
unsigned MSVCConstexprAllowed = 0

Detailed Description

Frame storing local variables.

Definition at line 27 of file InterpFrame.h.

Constructor & Destructor Documentation

◆ InterpFrame() [1/3]

InterpFrame::InterpFrame ( InterpState & S)

Bottom Frame.

Definition at line 25 of file InterpFrame.cpp.

References Caller, and clang::nullptr.

Referenced by allocSize(), dump(), free(), getCallRange(), InterpFrame(), and InterpFrame().

◆ InterpFrame() [2/3]

InterpFrame::InterpFrame ( InterpState & S,
const Function * Func,
InterpFrame * Caller,
CodePtr RetPC,
unsigned ArgSize )

Creates a new frame for a method call.

Definition at line 29 of file InterpFrame.cpp.

References clang::interp::Block, Caller, clang::for(), clang::if(), and InterpFrame().

◆ InterpFrame() [3/3]

InterpFrame::InterpFrame ( InterpState & S,
const Function * Func,
CodePtr RetPC,
unsigned VarArgSize = 0 )

Creates a new frame with the values that make sense.

I.e., the caller is the current frame of S, the This() pointer is the current Pointer on the top of S's stack, and the RVO pointer is before that.

Definition at line 54 of file InterpFrame.cpp.

References clang::if(), and InterpFrame().

◆ ~InterpFrame()

InterpFrame::~InterpFrame ( )

Destroys the frame, killing all live pointers to stack slots.

Definition at line 71 of file InterpFrame.cpp.

References destroyScopes().

Referenced by free().

Member Function Documentation

◆ allocSize()

size_t clang::interp::InterpFrame::allocSize ( const Function * F)
inlinestatic

Returns the number of bytes needed to allocate an InterpFrame for the given function.

Definition at line 51 of file InterpFrame.h.

References clang::interp::Function::getArgSize(), clang::interp::Function::getFrameSize(), clang::interp::Function::getNumWrittenParams(), and InterpFrame().

Referenced by clang::interp::Call(), and clang::interp::CallVar().

◆ describe()

void InterpFrame::describe ( llvm::raw_ostream & OS) const
overridevirtual

◆ destroy()

void InterpFrame::destroy ( unsigned Idx)

Invokes the destructors for a scope.

Definition at line 115 of file InterpFrame.cpp.

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

◆ destroyScopes()

void InterpFrame::destroyScopes ( )

Definition at line 85 of file InterpFrame.cpp.

References clang::interp::Scope::locals().

Referenced by ~InterpFrame().

◆ dump() [1/2]

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

Definition at line 167 of file InterpFrame.h.

References dump().

Referenced by dump().

◆ dump() [2/2]

LLVM_DUMP_METHOD void InterpFrame::dump ( llvm::raw_ostream & OS,
unsigned Indent = 0 ) const

◆ enableLocal()

void InterpFrame::enableLocal ( unsigned Idx)

Definition at line 104 of file InterpFrame.cpp.

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

◆ free()

void clang::interp::InterpFrame::free ( InterpFrame * F)
inlinestatic

◆ getCallee()

const FunctionDecl * InterpFrame::getCallee ( ) const
overridevirtual

Returns the caller.

Implements clang::interp::Frame.

Definition at line 238 of file InterpFrame.cpp.

Referenced by describe(), clang::interp::interp__builtin_is_within_lifetime(), and clang::interp::NoRet().

◆ getCaller()

Frame * clang::interp::InterpFrame::getCaller ( ) const
inlineoverridevirtual

Returns the parent frame object.

Implements clang::interp::Frame.

Definition at line 84 of file InterpFrame.h.

References Caller.

◆ getCallRange()

SourceRange InterpFrame::getCallRange ( ) const
overridevirtual

Returns the location of the call to the frame.

Implements clang::interp::Frame.

Definition at line 219 of file InterpFrame.cpp.

References clang::C, Caller, InterpFrame(), and clang::SourceRange::isValid().

◆ getDepth()

◆ getExpr()

◆ getFrameOffset()

size_t clang::interp::InterpFrame::getFrameOffset ( ) const
inline

Returns the offset on the stack at which the frame starts.

Definition at line 96 of file InterpFrame.h.

Referenced by clang::interp::Ret(), and clang::interp::RetVoid().

◆ getFunction()

◆ getLocal()

template<typename T>
const T & clang::interp::InterpFrame::getLocal ( unsigned Offset) const
inline

Returns the value of a local variable.

Definition at line 99 of file InterpFrame.h.

◆ getLocalBlock()

Block * InterpFrame::getLocalBlock ( unsigned Offset) const

Definition at line 249 of file InterpFrame.cpp.

Referenced by clang::interp::Destroy(), and clang::interp::GetLocal().

◆ getLocalPointer()

Pointer InterpFrame::getLocalPointer ( unsigned Offset) const

Returns a pointer to a local variables.

Definition at line 244 of file InterpFrame.cpp.

References Pointer.

Referenced by clang::interp::Destroy(), and clang::interp::GetPtrLocal().

◆ getLocation()

◆ getName()

std::string clang::interp::InterpFrame::getName ( ) const
inline

Definition at line 56 of file InterpFrame.h.

◆ getParam()

template<typename T>
const T & clang::interp::InterpFrame::getParam ( unsigned Index) const
inline

Returns the value of an argument.

Definition at line 114 of file InterpFrame.h.

References clang::interp::Block::deref(), and clang::interp::Block::isInitialized().

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

◆ getParamPointer()

◆ getPC()

CodePtr clang::interp::InterpFrame::getPC ( ) const
inline

Returns the PC of the frame's code start.

Definition at line 150 of file InterpFrame.h.

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

◆ getRange()

◆ getRetPC()

CodePtr clang::interp::InterpFrame::getRetPC ( ) const
inline

◆ getRVOPtr()

const Pointer & clang::interp::InterpFrame::getRVOPtr ( ) const
inline

Returns the RVO pointer, if the Function has one.

Definition at line 139 of file InterpFrame.h.

References isBottomFrame().

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

◆ getSource()

SourceInfo InterpFrame::getSource ( CodePtr PC) const

Map a location to a source.

Definition at line 280 of file InterpFrame.cpp.

References Caller, funcHasUsableBody(), and clang::Result.

Referenced by clang::interp::AllocN(), clang::interp::ArrayDecay(), clang::interp::BitCastPrim(), clang::interp::CallPtr(), clang::interp::CallVirt(), clang::interp::CheckActive(), clang::interp::CheckArray(), clang::interp::CheckArraySize(), clang::interp::CheckArraySize(), clang::interp::CheckBitCast(), clang::interp::CheckCallDepth(), clang::interp::CheckConst(), clang::interp::CheckDeleteSource(), clang::interp::CheckDestructor(), clang::interp::CheckDivRem(), clang::interp::CheckDummy(), clang::interp::CheckDynamicMemoryAllocation(), clang::interp::CheckFloatResult(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), clang::interp::CheckLoad(), clang::interp::CheckMutable(), clang::interp::CheckNewDeleteForms(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckNull(), clang::interp::CheckNull(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckPseudoDtor(), clang::interp::CheckRange(), clang::interp::CheckRange(), clang::interp::CheckShift(), clang::interp::CheckSubobject(), CheckTemporary(), clang::interp::CMP3(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< MemberPointer >(), clang::interp::CmpHelperEQ< Pointer >(), diagnoseMissingInitializer(), clang::interp::diagnoseNonConstexprBuiltin(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), diagnoseUnknownDecl(), clang::interp::Divc(), clang::interp::DoShift(), clang::interp::DoShiftAP(), clang::interp::FnPtrCast(), clang::interp::Free(), clang::interp::getField(), clang::interp::GetIntPtr(), clang::interp::GetPtrDerivedPop(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_ia32_vcvtps2ph(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_operator_delete(), clang::interp::interp__builtin_operator_new(), clang::interp::InvalidDeclRef(), clang::interp::InvalidNewDeleteExpr(), clang::interp::InvalidShuffleVectorIndex(), clang::interp::InvalidStore(), clang::interp::OffsetHelper(), clang::interp::PtrPtrCast(), clang::interp::runRecordDestructor(), and clang::interp::SubPtr().

◆ getThis()

◆ hasThisPointer()

bool clang::interp::InterpFrame::hasThisPointer ( ) const
inline

◆ initScope()

void InterpFrame::initScope ( unsigned Idx)

Definition at line 95 of file InterpFrame.cpp.

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

◆ isBottomFrame()

bool clang::interp::InterpFrame::isBottomFrame ( ) const
inline

◆ isLocalEnabled()

bool clang::interp::InterpFrame::isLocalEnabled ( unsigned Idx) const
inline

Definition at line 76 of file InterpFrame.h.

Referenced by clang::interp::EnableLocal(), and clang::interp::GetLocalEnabled().

◆ isRoot()

bool clang::interp::InterpFrame::isRoot ( ) const
inline

Checks if the frame is a root frame - return should quit the interpreter.

Definition at line 147 of file InterpFrame.h.

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

◆ isStdFunction()

bool InterpFrame::isStdFunction ( ) const

Definition at line 315 of file InterpFrame.cpp.

References clang::DeclContext::getParent().

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

◆ setLocal()

template<typename T>
void clang::interp::InterpFrame::setLocal ( unsigned Offset,
const T & Value )
inline

Mutates a local variable.

Definition at line 104 of file InterpFrame.h.

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

◆ setParam()

template<typename T>
void clang::interp::InterpFrame::setParam ( unsigned Index,
const T & Value )
inline

Mutates a local copy of a parameter.

Definition at line 122 of file InterpFrame.h.

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

Member Data Documentation

◆ Caller

◆ MSVCConstexprAllowed


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