clang 20.0.0git
|
Frame storing local variables. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/InterpFrame.h"
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 | initScope (unsigned Idx) |
void | popArgs () |
Pops the arguments off the stack. | |
void | describe (llvm::raw_ostream &OS) const override |
Describes the frame with arguments for diagnostic purposes. | |
Frame * | getCaller () const override |
Returns the parent frame object. | |
SourceRange | getCallRange () const override |
Returns the location of the call to the frame. | |
const FunctionDecl * | getCallee () const override |
Returns the caller. | |
const Function * | getFunction () 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 Pointer & | getThis () const |
Returns the 'this' pointer. | |
const Pointer & | getRVOPtr () 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 Expr * | getExpr (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 Frame * | getCaller () const =0 |
Returns a pointer to the caller frame. | |
virtual SourceRange | getCallRange () const =0 |
Returns the location of the call site. | |
virtual const FunctionDecl * | getCallee () const =0 |
Returns the called function's declaration. | |
Public Attributes | |
InterpFrame * | Caller |
The frame of the previous function. | |
Frame storing local variables.
Definition at line 26 of file InterpFrame.h.
InterpFrame::InterpFrame | ( | InterpState & | S, |
const Function * | Func, | ||
InterpFrame * | Caller, | ||
CodePtr | RetPC, | ||
unsigned | ArgSize | ||
) |
Creates a new frame for a method call.
Definition at line 26 of file InterpFrame.cpp.
References clang::Func, and clang::interp::Scope::locals().
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 49 of file InterpFrame.cpp.
References clang::Func.
InterpFrame::~InterpFrame | ( | ) |
Destroys the frame, killing all live pointers to stack slots.
Definition at line 69 of file InterpFrame.cpp.
References clang::interp::InterpState::deallocate(), clang::interp::Scope::locals(), and clang::interp::Function::scopes().
|
overridevirtual |
Describes the frame with arguments for diagnostic purposes.
Implements clang::interp::Frame.
Definition at line 164 of file InterpFrame.cpp.
References clang::interp::align(), Caller, clang::interp::Context::classify(), clang::interp::InterpState::Ctx, getCallee(), clang::interp::InterpState::getCtx(), getExpr(), getFunction(), clang::ASTContext::getLValueReferenceType(), clang::FunctionDecl::getNameForDiagnostic(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::ASTContext::getPrintingPolicy(), clang::ASTContext::getRecordType(), getRetPC(), clang::ValueDecl::getType(), clang::interp::Function::hasRVO(), clang::interp::Function::hasThisPointer(), clang::interp::primSize(), print(), clang::interp::PT_Ptr, and TYPE_SWITCH.
Referenced by dump().
void InterpFrame::destroy | ( | unsigned | Idx | ) |
Invokes the destructors for a scope.
Definition at line 93 of file InterpFrame.cpp.
References clang::interp::InterpState::deallocate(), clang::interp::Function::getScope(), and clang::interp::Scope::locals().
|
inline |
LLVM_DUMP_METHOD void InterpFrame::dump | ( | llvm::raw_ostream & | OS, |
unsigned | Indent = 0 |
||
) | const |
Definition at line 265 of file Disasm.cpp.
References Caller, describe(), getCallee(), getDepth(), clang::interp::Function::getFrameSize(), getFunction(), getRVOPtr(), and getThis().
|
overridevirtual |
Returns the caller.
Implements clang::interp::Frame.
Definition at line 238 of file InterpFrame.cpp.
References clang::interp::Function::getDecl().
Referenced by describe(), dump(), and clang::interp::interp__builtin_is_constant_evaluated().
|
overridevirtual |
Returns the parent frame object.
Implements clang::interp::Frame.
Definition at line 223 of file InterpFrame.cpp.
References Caller, and clang::interp::InterpState::getSplitFrame().
|
overridevirtual |
Returns the location of the call to the frame.
Implements clang::interp::Frame.
Definition at line 229 of file InterpFrame.cpp.
References Caller, clang::interp::InterpState::EvalLocation, clang::interp::SourceMapper::getRange(), and clang::SourceRange::isValid().
|
inline |
Definition at line 121 of file InterpFrame.h.
Referenced by dump(), and clang::interp::InterpState::getCallStackDepth().
Definition at line 278 of file InterpFrame.cpp.
References Caller, clang::interp::Function::getDecl(), getExpr(), clang::interp::SourceMapper::getExpr(), clang::interp::Function::hasBody(), and clang::Decl::isImplicit().
Referenced by describe(), getExpr(), and clang::interp::interp__builtin_is_constant_evaluated().
|
inline |
Returns the offset on the stack at which the frame starts.
Definition at line 68 of file InterpFrame.h.
|
inline |
Returns the current function.
Definition at line 65 of file InterpFrame.h.
Referenced by describe(), and dump().
|
inline |
Returns the value of a local variable.
Definition at line 71 of file InterpFrame.h.
Returns a pointer to a local variables.
Definition at line 244 of file InterpFrame.cpp.
SourceLocation InterpFrame::getLocation | ( | CodePtr | PC | ) | const |
Definition at line 285 of file InterpFrame.cpp.
References Caller, clang::interp::Function::getDecl(), getLocation(), clang::interp::SourceMapper::getLocation(), clang::interp::Function::hasBody(), and clang::Decl::isImplicit().
Referenced by getLocation().
|
inline |
Returns the value of an argument.
Definition at line 85 of file InterpFrame.h.
References clang::interp::Pointer::deref(), and clang::T.
Returns a pointer to an argument - lazily creates a block.
Definition at line 249 of file InterpFrame.cpp.
References clang::interp::InterpState::Ctx, clang::interp::Context::getEvalID(), clang::interp::Function::getParamDescriptor(), clang::interp::Block::invokeCtor(), clang::T, and TYPE_SWITCH.
Referenced by setParam().
|
inline |
Returns the PC of the frame's code start.
Definition at line 110 of file InterpFrame.h.
References clang::interp::Function::getCodeBegin().
SourceRange InterpFrame::getRange | ( | CodePtr | PC | ) | const |
Definition at line 292 of file InterpFrame.cpp.
References Caller, clang::interp::Function::getDecl(), getRange(), clang::interp::SourceMapper::getRange(), clang::interp::Function::hasBody(), and clang::Decl::isImplicit().
Referenced by getRange().
|
inline |
Returns the return address of the frame.
Definition at line 113 of file InterpFrame.h.
Referenced by describe(), and clang::interp::interp__builtin_is_constant_evaluated().
|
inline |
Returns the RVO pointer, if the Function has one.
Definition at line 104 of file InterpFrame.h.
Referenced by dump().
|
virtual |
Map a location to a source.
Definition at line 269 of file InterpFrame.cpp.
References Caller, clang::interp::Function::getDecl(), getSource(), clang::interp::InterpState::getSource(), clang::interp::Function::hasBody(), and clang::Decl::isImplicit().
Referenced by getSource().
|
inline |
void InterpFrame::initScope | ( | unsigned | Idx | ) |
Definition at line 85 of file InterpFrame.cpp.
References clang::interp::Function::getScope(), clang::interp::Block::invokeCtor(), and clang::interp::Scope::locals().
|
inline |
Checks if the frame is a root frame - return should quit the interpreter.
Definition at line 107 of file InterpFrame.h.
void InterpFrame::popArgs | ( | ) |
Pops the arguments off the stack.
Definition at line 99 of file InterpFrame.cpp.
References clang::interp::Function::args_reverse(), clang::interp::InterpStack::discard(), clang::interp::InterpState::Stk, clang::T, and TYPE_SWITCH.
|
inline |
Mutates a local variable.
Definition at line 76 of file InterpFrame.h.
References clang::interp::InlineDescriptor::IsInitialized.
|
inline |
Mutates a local copy of a parameter.
Definition at line 93 of file InterpFrame.h.
References clang::interp::Pointer::deref(), getParamPointer(), and clang::T.
InterpFrame* clang::interp::InterpFrame::Caller |
The frame of the previous function.
Definition at line 29 of file InterpFrame.h.
Referenced by describe(), dump(), getCaller(), getCallRange(), clang::interp::InterpState::getCurrentFrame(), getExpr(), getLocation(), getRange(), getSource(), clang::interp::interp__builtin_is_constant_evaluated(), and clang::interp::InterpState::~InterpState().