clang 19.0.0git
Public Member Functions | Public Attributes | List of all members
clang::interp::InterpFrame Class Referencefinal

Frame storing local variables. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/Interp/InterpFrame.h"

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

Public Member Functions

 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.
 
void destroy (unsigned Idx)
 Invokes the destructors for a scope.
 
void popArgs ()
 Pops the arguments off the stack.
 
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.
 
template<typename T >
const T & getParam (unsigned Offset) const
 Returns the value of an argument.
 
template<typename T >
void setParam (unsigned Offset, const T &Value)
 Mutates a local copy of a parameter.
 
Pointer getParamPointer (unsigned Offset)
 Returns a pointer to an argument - lazily creates a block.
 
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.
 
virtual 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
 
void dump () const
 
void dump (llvm::raw_ostream &OS, unsigned Indent=0) const
 
- Public Member Functions inherited from clang::interp::Frame
virtual ~Frame ()
 
virtual void describe (llvm::raw_ostream &OS) const =0
 Generates a human-readable description of the call site.
 
virtual FramegetCaller () const =0
 Returns a pointer to the caller frame.
 
virtual SourceRange getCallRange () const =0
 Returns the location of the call site.
 
virtual const FunctionDeclgetCallee () const =0
 Returns the called function's declaration.
 

Public Attributes

InterpFrameCaller
 The frame of the previous function.
 

Detailed Description

Frame storing local variables.

Definition at line 28 of file InterpFrame.h.

Constructor & Destructor Documentation

◆ InterpFrame() [1/2]

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

Creates a new frame for a method call.

Definition at line 24 of file InterpFrame.cpp.

References clang::Func, clang::interp::Block::invokeCtor(), and clang::interp::Scope::locals().

◆ InterpFrame() [2/2]

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 46 of file InterpFrame.cpp.

References clang::Func.

◆ ~InterpFrame()

InterpFrame::~InterpFrame ( )

Member Function Documentation

◆ 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 84 of file InterpFrame.cpp.

References clang::interp::InterpState::deallocate(), clang::interp::Function::getScope(), and clang::interp::Scope::locals().

◆ dump() [1/2]

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

Definition at line 126 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

Definition at line 211 of file Disasm.cpp.

References Caller, describe(), getCallee(), getDepth(), getFunction(), getRVOPtr(), and getThis().

◆ getCallee()

const FunctionDecl * InterpFrame::getCallee ( ) const
overridevirtual

Returns the caller.

Implements clang::interp::Frame.

Definition at line 192 of file InterpFrame.cpp.

References clang::interp::Function::getDecl().

Referenced by describe(), dump(), and clang::interp::interp__builtin_is_constant_evaluated().

◆ getCaller()

Frame * InterpFrame::getCaller ( ) const
overridevirtual

Returns the parent frame object.

Implements clang::interp::Frame.

Definition at line 180 of file InterpFrame.cpp.

References Caller, and clang::interp::InterpState::getSplitFrame().

◆ getCallRange()

SourceRange InterpFrame::getCallRange ( ) const
overridevirtual

Returns the location of the call to the frame.

Implements clang::interp::Frame.

Definition at line 186 of file InterpFrame.cpp.

References Caller, and clang::interp::SourceMapper::getRange().

◆ getDepth()

unsigned clang::interp::InterpFrame::getDepth ( ) const
inline

Definition at line 124 of file InterpFrame.h.

Referenced by dump(), and clang::interp::InterpState::getCallStackDepth().

◆ getExpr()

const Expr * InterpFrame::getExpr ( CodePtr  PC) const

◆ getFrameOffset()

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

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

Definition at line 69 of file InterpFrame.h.

◆ getFunction()

const Function * clang::interp::InterpFrame::getFunction ( ) const
inline

Returns the current function.

Definition at line 66 of file InterpFrame.h.

Referenced by dump().

◆ getLocal()

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

Returns the value of a local variable.

Definition at line 72 of file InterpFrame.h.

◆ getLocalPointer()

Pointer InterpFrame::getLocalPointer ( unsigned  Offset) const

Returns a pointer to a local variables.

Definition at line 198 of file InterpFrame.cpp.

◆ getLocation()

SourceLocation InterpFrame::getLocation ( CodePtr  PC) const

◆ getParam()

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

Returns the value of an argument.

Definition at line 86 of file InterpFrame.h.

References clang::interp::Pointer::deref().

◆ getParamPointer()

Pointer InterpFrame::getParamPointer ( unsigned  Offset)

Returns a pointer to an argument - lazily creates a block.

Definition at line 203 of file InterpFrame.cpp.

References clang::interp::Function::getParamDescriptor(), and TYPE_SWITCH.

Referenced by setParam().

◆ getPC()

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

Returns the PC of the frame's code start.

Definition at line 113 of file InterpFrame.h.

References clang::interp::Function::getCodeBegin().

◆ getRange()

SourceRange InterpFrame::getRange ( CodePtr  PC) const

◆ getRetPC()

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

Returns the return address of the frame.

Definition at line 116 of file InterpFrame.h.

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

◆ getRVOPtr()

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

Returns the RVO pointer, if the Function has one.

Definition at line 107 of file InterpFrame.h.

Referenced by dump().

◆ getSource()

SourceInfo InterpFrame::getSource ( CodePtr  PC) const
virtual

◆ getThis()

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

Returns the 'this' pointer.

Definition at line 104 of file InterpFrame.h.

Referenced by dump().

◆ isRoot()

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

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

Definition at line 110 of file InterpFrame.h.

◆ popArgs()

void InterpFrame::popArgs ( )

◆ setLocal()

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

Mutates a local variable.

Definition at line 77 of file InterpFrame.h.

References clang::interp::InlineDescriptor::IsInitialized.

◆ setParam()

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

Mutates a local copy of a parameter.

Definition at line 96 of file InterpFrame.h.

References clang::interp::Pointer::deref(), and getParamPointer().

Member Data Documentation

◆ Caller

InterpFrame* clang::interp::InterpFrame::Caller

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