|
clang 23.0.0git
|
Frame storing local variables. More...
#include "/work/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. | |
| 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. | |
| 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 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 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 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 | |
| InterpFrame * | Caller |
| The frame of the previous function. | |
| unsigned | MSVCConstexprAllowed = 0 |
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 allocSize(), 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, clang::for(), clang::if(), and InterpFrame().
| 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 | ( | ) |
Destroys the frame, killing all live pointers to stack slots.
Definition at line 71 of file InterpFrame.cpp.
References destroyScopes().
Referenced by free().
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().
|
overridevirtual |
Describes the frame with arguments for diagnostic purposes.
Implements clang::interp::Frame.
Definition at line 159 of file InterpFrame.cpp.
References clang::interp::align(), Caller, getCallee(), clang::FunctionDecl::getNameForDiagnostic(), getRetPC(), getThis(), clang::isa(), clang::FunctionDecl::parameters(), 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 115 of file InterpFrame.cpp.
Referenced by clang::interp::Destroy().
| void InterpFrame::destroyScopes | ( | ) |
Definition at line 85 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 504 of file Disasm.cpp.
References Caller, describe(), clang::ast_matchers::getCallee(), getDepth(), getFunction(), getRVOPtr(), getThis(), hasThisPointer(), clang::Indent(), and InterpFrame().
| void InterpFrame::enableLocal | ( | unsigned | Idx | ) |
Definition at line 104 of file InterpFrame.cpp.
Referenced by clang::interp::EnableLocal().
|
inlinestatic |
Definition at line 62 of file InterpFrame.h.
References InterpFrame(), isBottomFrame(), and ~InterpFrame().
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::Ret(), and clang::interp::RetVoid().
|
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().
|
inlineoverridevirtual |
Returns the parent frame object.
Implements clang::interp::Frame.
Definition at line 84 of file InterpFrame.h.
References Caller.
|
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().
|
inline |
Definition at line 161 of file InterpFrame.h.
Referenced by clang::interp::CheckCallable(), clang::interp::CheckCallDepth(), clang::interp::CheckFunctionDecl(), 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 294 of file InterpFrame.cpp.
References Caller, and funcHasUsableBody().
Referenced by clang::interp::AddSubMulHelper(), clang::interp::CallVirt(), clang::interp::CastFloatingIntegral(), clang::interp::CheckBitCast(), 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 96 of file InterpFrame.h.
Referenced by clang::interp::Ret(), and clang::interp::RetVoid().
|
inline |
Returns the current function.
Definition at line 93 of file InterpFrame.h.
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::CheckLiteralType(), clang::interp::Destroy(), dump(), clang::interp::GetTypeidPtr(), clang::interp::Ret(), clang::interp::RetVoid(), clang::interp::runRecordDestructor(), clang::interp::RVOPtr(), and clang::interp::This().
|
inline |
Returns the value of a local variable.
Definition at line 99 of file InterpFrame.h.
Definition at line 249 of file InterpFrame.cpp.
Referenced by clang::interp::Destroy(), and clang::interp::GetLocal().
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().
| SourceLocation InterpFrame::getLocation | ( | CodePtr | PC | ) | const |
Definition at line 301 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::diagnoseCallableDecl(), clang::interp::diagnoseEnumValue(), clang::interp::InterpretBuiltin(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::ShiftFixedPoint(), and clang::interp::Unsupported().
|
inline |
Definition at line 56 of file InterpFrame.h.
|
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().
Returns a pointer to an argument - lazily creates a block.
Definition at line 253 of file InterpFrame.cpp.
References clang::interp::Block::data(), clang::interp::Block::getDescriptor(), clang::interp::Descriptor::getPrimType(), clang::interp::Block::invokeCtor(), isBottomFrame(), clang::interp::Block::isInitialized(), clang::interp::Descriptor::isPrimitive(), Pointer, and TYPE_SWITCH.
Referenced by clang::interp::GetPtrParam().
|
inline |
Returns the PC of the frame's code start.
Definition at line 150 of file InterpFrame.h.
Referenced by clang::interp::Interpret().
| SourceRange InterpFrame::getRange | ( | CodePtr | PC | ) | const |
Definition at line 308 of file InterpFrame.cpp.
References Caller, and funcHasUsableBody().
Referenced by clang::interp::CheckBitCast(), clang::interp::CheckFloatResult(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), 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 153 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 139 of file InterpFrame.h.
References isBottomFrame().
Referenced by dump(), and clang::interp::RVOPtr().
| 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().
|
inline |
Returns the 'this' pointer.
Definition at line 132 of file InterpFrame.h.
References hasThisPointer(), and isBottomFrame().
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 129 of file InterpFrame.h.
Referenced by clang::interp::ActivateThisField(), clang::interp::CheckThis(), dump(), getThis(), and clang::interp::runRecordDestructor().
| void InterpFrame::initScope | ( | unsigned | Idx | ) |
Definition at line 95 of file InterpFrame.cpp.
Referenced by clang::interp::InitScope().
|
inline |
Definition at line 165 of file InterpFrame.h.
References Caller.
Referenced by clang::interp::CheckLiteralType(), clang::interp::CtorCheck(), free(), getParamPointer(), clang::interp::GetPtrParam(), getRVOPtr(), getThis(), and clang::interp::runRecordDestructor().
Definition at line 76 of file InterpFrame.h.
Referenced by clang::interp::EnableLocal(), and clang::interp::GetLocalEnabled().
|
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().
| bool InterpFrame::isStdFunction | ( | ) | const |
Definition at line 315 of file InterpFrame.cpp.
References clang::DeclContext::getParent().
Referenced by clang::interp::InvalidNewDeleteExpr().
|
inline |
Mutates a local variable.
Definition at line 104 of file InterpFrame.h.
Referenced by clang::interp::SetLocal().
|
inline |
Mutates a local copy of a parameter.
Definition at line 122 of file InterpFrame.h.
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().
| unsigned clang::interp::InterpFrame::MSVCConstexprAllowed = 0 |
Definition at line 229 of file InterpFrame.h.
Referenced by clang::interp::CheckCallable(), clang::interp::CheckFunctionDecl(), clang::interp::InvalidNewDeleteExpr(), clang::interp::PopMSVCCE(), and clang::interp::PushMSVCCE().