clang 22.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) | |
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. | |
void | destroy (unsigned Idx) |
Invokes the destructors for a scope. | |
void | initScope (unsigned Idx) |
void | destroyScopes () |
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. | |
Block * | getLocalBlock (unsigned Offset) const |
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. | |
bool | hasThisPointer () const |
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. | |
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 |
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 void | free (InterpFrame *F) |
Public Attributes | |
InterpFrame * | Caller |
The frame of the previous function. |
Frame storing local variables.
Definition at line 27 of file InterpFrame.h.
InterpFrame::InterpFrame | ( | InterpState & | S | ) |
Bottom Frame.
Definition at line 25 of file InterpFrame.cpp.
References Caller, and clang::nullptr.
Referenced by dump(), free(), getCallRange(), InterpFrame(), and InterpFrame().
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, InterpFrame(), 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 52 of file InterpFrame.cpp.
References clang::if(), and InterpFrame().
InterpFrame::~InterpFrame | ( | ) |
Destroys the frame, killing all live pointers to stack slots.
Definition at line 69 of file InterpFrame.cpp.
References destroyScopes().
|
overridevirtual |
Describes the frame with arguments for diagnostic purposes.
Implements clang::interp::Frame.
Definition at line 141 of file InterpFrame.cpp.
References clang::interp::align(), Caller, clang::cast(), getCallee(), getFunction(), clang::FunctionDecl::getNameForDiagnostic(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), getRetPC(), getThis(), clang::ValueDecl::getType(), clang::isa(), clang::interp::primSize(), print(), clang::interp::PT_Ptr, shouldSkipInBacktrace(), and TYPE_SWITCH.
Referenced by dump().
void InterpFrame::destroy | ( | unsigned | Idx | ) |
Invokes the destructors for a scope.
Definition at line 97 of file InterpFrame.cpp.
Referenced by clang::interp::Destroy().
void InterpFrame::destroyScopes | ( | ) |
Definition at line 79 of file InterpFrame.cpp.
References clang::interp::Scope::locals().
Referenced by ~InterpFrame().
|
inline |
LLVM_DUMP_METHOD void InterpFrame::dump | ( | llvm::raw_ostream & | OS, |
unsigned | Indent = 0 ) const |
Definition at line 470 of file Disasm.cpp.
References Caller, describe(), clang::ast_matchers::getCallee(), getDepth(), getFunction(), getRVOPtr(), getThis(), clang::Indent(), and InterpFrame().
|
inlinestatic |
Definition at line 49 of file InterpFrame.h.
References InterpFrame(), and isBottomFrame().
Referenced by clang::interp::Ret(), and clang::interp::RetVoid().
|
overridevirtual |
Returns the caller.
Implements clang::interp::Frame.
Definition at line 214 of file InterpFrame.cpp.
Referenced by describe(), clang::interp::interp__builtin_is_within_lifetime(), and clang::interp::NoRet().
|
inlineoverridevirtual |
Returns the parent frame object.
Implements clang::interp::Frame.
Definition at line 63 of file InterpFrame.h.
References Caller.
|
overridevirtual |
Returns the location of the call to the frame.
Implements clang::interp::Frame.
Definition at line 195 of file InterpFrame.cpp.
References clang::C, Caller, InterpFrame(), and clang::SourceRange::isValid().
|
inline |
Definition at line 137 of file InterpFrame.h.
Referenced by clang::interp::CheckCallable(), clang::interp::CheckCallDepth(), dump(), clang::interp::GetPtrThisField(), clang::interp::InitThisBitField(), clang::interp::InitThisBitFieldActivate(), clang::interp::InitThisField(), clang::interp::InitThisFieldActivate(), and clang::interp::interp__builtin_is_constant_evaluated().
Definition at line 274 of file InterpFrame.cpp.
References Caller, and funcHasUsableBody().
Referenced by clang::interp::AddSubMulHelper(), clang::interp::CallVirt(), clang::interp::CastFloatingIntegral(), clang::interp::CheckBitCast(), CheckBitcastType(), clang::interp::CheckDivRem(), clang::interp::CheckDowncast(), clang::interp::CheckLiteralType(), clang::interp::CheckShift(), clang::interp::CheckThis(), clang::interp::cleanupAfterFunctionCall(), clang::interp::DiagTypeid(), clang::interp::DoBitCastPtr(), clang::interp::GetDynamicDecl(), clang::interp::handleFixedPointOverflow(), clang::interp::handleOverflow(), clang::interp::IncDecHelper(), clang::interp::interp__builtin_is_constant_evaluated(), clang::interp::InvalidCast(), clang::interp::Neg(), clang::interp::PtrPtrCast(), clang::interp::ShiftFixedPoint(), and clang::interp::SizelessVectorElementSize().
|
inline |
Returns the offset on the stack at which the frame starts.
Definition at line 75 of file InterpFrame.h.
Referenced by clang::interp::Ret(), and clang::interp::RetVoid().
|
inline |
Returns the current function.
Definition at line 72 of file InterpFrame.h.
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::CheckLiteralType(), describe(), clang::interp::Destroy(), dump(), clang::interp::GetTypeidPtr(), clang::interp::Ret(), clang::interp::RetVoid(), clang::interp::runRecordDestructor(), clang::interp::RVOPtr(), and clang::interp::This().
Returns the value of a local variable.
Definition at line 78 of file InterpFrame.h.
References clang::T.
Definition at line 225 of file InterpFrame.cpp.
Referenced by clang::interp::GetLocal().
Returns a pointer to a local variables.
Definition at line 220 of file InterpFrame.cpp.
References Pointer.
Referenced by clang::interp::Destroy(), and clang::interp::GetPtrLocal().
SourceLocation InterpFrame::getLocation | ( | CodePtr | PC | ) | const |
Definition at line 281 of file InterpFrame.cpp.
References Caller, and funcHasUsableBody().
Referenced by clang::interp::Assume(), clang::interp::CheckCallable(), clang::interp::CheckConstant(), clang::interp::checkConstructor(), CheckGlobal(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLocalLoad(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckNonNullArg(), clang::interp::CheckNonNullArgs(), clang::interp::CheckVolatile(), clang::interp::CheckWeak(), clang::interp::diagnoseEnumValue(), clang::interp::InterpretBuiltin(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::ShiftFixedPoint(), and clang::interp::Unsupported().
Returns the value of an argument.
Definition at line 93 of file InterpFrame.h.
References clang::interp::Block::deref(), and clang::T.
Referenced by clang::interp::GetParam().
Returns a pointer to an argument - lazily creates a block.
Definition at line 229 of file InterpFrame.cpp.
References clang::interp::Block, isBottomFrame(), Pointer, clang::T, and TYPE_SWITCH.
Referenced by clang::interp::GetPtrParam(), and setParam().
|
inline |
Returns the PC of the frame's code start.
Definition at line 126 of file InterpFrame.h.
Referenced by clang::interp::Interpret().
SourceRange InterpFrame::getRange | ( | CodePtr | PC | ) | const |
Definition at line 288 of file InterpFrame.cpp.
References Caller, and funcHasUsableBody().
Referenced by clang::interp::CastPointerIntegral(), clang::interp::CheckFloatResult(), clang::interp::CheckLifetime(), clang::interp::CheckNull(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckRange(), clang::interp::CheckRange(), clang::interp::CheckSubobject(), clang::interp::DiagnoseUninitialized(), clang::interp::FnPtrCast(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::InterpretBuiltin(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::PtrPtrCast(), clang::interp::SizelessVectorElementSize(), and clang::interp::Unsupported().
|
inline |
Returns the return address of the frame.
Definition at line 129 of file InterpFrame.h.
Referenced by clang::interp::cleanupAfterFunctionCall(), describe(), clang::interp::interp__builtin_is_constant_evaluated(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::Ret(), and clang::interp::RetVoid().
|
inline |
Returns the RVO pointer, if the Function has one.
Definition at line 116 of file InterpFrame.h.
Referenced by dump(), and clang::interp::RVOPtr().
SourceInfo InterpFrame::getSource | ( | CodePtr | PC | ) | const |
Map a location to a source.
Definition at line 260 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::CastPointerIntegral(), clang::interp::CheckActive(), clang::interp::CheckArray(), clang::interp::CheckArraySize(), clang::interp::CheckArraySize(), 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::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_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::InvalidCast(), 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().
|
inline |
Returns the 'this' pointer.
Definition at line 110 of file InterpFrame.h.
References hasThisPointer().
Referenced by clang::interp::ActivateThisField(), clang::interp::CheckLiteralType(), describe(), dump(), clang::interp::GetPtrThisBase(), clang::interp::GetPtrThisField(), clang::interp::GetPtrThisVirtBase(), clang::interp::GetThisField(), clang::interp::InitThisBitField(), clang::interp::InitThisBitFieldActivate(), clang::interp::InitThisField(), clang::interp::InitThisFieldActivate(), clang::interp::runRecordDestructor(), clang::interp::SetThisField(), and clang::interp::This().
|
inline |
Definition at line 108 of file InterpFrame.h.
Referenced by clang::interp::ActivateThisField(), clang::interp::CheckThis(), getThis(), and clang::interp::runRecordDestructor().
void InterpFrame::initScope | ( | unsigned | Idx | ) |
Definition at line 89 of file InterpFrame.cpp.
Referenced by clang::interp::InitScope().
|
inline |
Definition at line 141 of file InterpFrame.h.
References Caller.
Referenced by free(), getParamPointer(), and clang::interp::GetPtrParam().
|
inline |
Checks if the frame is a root frame - return should quit the interpreter.
Definition at line 123 of file InterpFrame.h.
Referenced by clang::interp::Interpret().
bool InterpFrame::isStdFunction | ( | ) | const |
Definition at line 295 of file InterpFrame.cpp.
References clang::DeclContext::getParent().
Referenced by clang::interp::InvalidNewDeleteExpr().
|
inline |
Mutates a local variable.
Definition at line 83 of file InterpFrame.h.
References clang::T.
Referenced by clang::interp::SetLocal().
|
inline |
Mutates a local copy of a parameter.
Definition at line 101 of file InterpFrame.h.
References clang::interp::Pointer::deref(), getParamPointer(), and clang::T.
Referenced by clang::interp::SetParam().
InterpFrame* clang::interp::InterpFrame::Caller |
The frame of the previous function.
Definition at line 30 of file InterpFrame.h.
Referenced by clang::interp::cleanupAfterFunctionCall(), describe(), dump(), getCaller(), getCallRange(), getExpr(), getLocation(), getRange(), getSource(), clang::interp::interp__builtin_is_within_lifetime(), InterpFrame(), InterpFrame(), isBottomFrame(), clang::interp::Ret(), and clang::interp::RetVoid().