|
clang 24.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 | getRetPC () const |
| Returns the return address of the frame. | |
| CodePtr | getRetOpPC () const |
| Returns the return address of the opcode in the caller 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 |
| unsigned | getArgSize () 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::interp::Block::InlineDescMD, 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 60 of file InterpFrame.cpp.
References getArgSize(), 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 48 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 155 of file InterpFrame.cpp.
References clang::interp::align(), Caller, clang::ASTContext::getCanonicalTagType(), clang::ASTContext::getLValueReferenceType(), clang::FunctionDecl::getNameForDiagnostic(), clang::ASTContext::getPrintingPolicy(), getRetOpPC(), getThis(), clang::isa(), clang::Off, clang::FunctionDecl::parameters(), clang::interp::primSize(), print(), clang::interp::PT_Ptr, shouldSkipInBacktrace(), clang::PrintingPolicy::SuppressLambdaBody, and TYPE_SWITCH.
Referenced by dump().
| void InterpFrame::destroy | ( | unsigned | Idx | ) |
Invokes the destructors for a scope.
Definition at line 116 of file InterpFrame.cpp.
| 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 537 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 105 of file InterpFrame.cpp.
Referenced by clang::interp::EnableLocal().
|
inlinestatic |
Definition at line 59 of file InterpFrame.h.
References InterpFrame(), isBottomFrame(), and ~InterpFrame().
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::Ret(), and clang::interp::RetVoid().
|
inline |
Definition at line 168 of file InterpFrame.h.
Referenced by clang::interp::cleanupAfterFunctionCall(), and InterpFrame().
|
overridevirtual |
Returns the caller.
Implements clang::interp::Frame.
Definition at line 237 of file InterpFrame.cpp.
Referenced by clang::interp::interp__builtin_is_within_lifetime(), and clang::interp::NoRet().
|
inlineoverridevirtual |
Returns the parent frame object.
Implements clang::interp::Frame.
Definition at line 81 of file InterpFrame.h.
References Caller.
|
overridevirtual |
Returns the location of the call to the frame.
Implements clang::interp::Frame.
Definition at line 217 of file InterpFrame.cpp.
References clang::C, Caller, InterpFrame(), and clang::SourceRange::isValid().
|
inline |
Definition at line 167 of file InterpFrame.h.
Referenced by clang::interp::CheckCallDepth(), clang::interp::CheckFunctionDecl(), dump(), and clang::interp::interp__builtin_is_constant_evaluated().
Definition at line 161 of file InterpFrame.h.
References clang::interp::SourceInfo::asExpr(), and getSource().
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::CheckThis(), clang::interp::diagnoseShiftFailure(), clang::interp::DiagTypeid(), clang::interp::DoBitCastPtr(), clang::interp::DynamicCast(), clang::interp::GetTypeidPtr(), 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 94 of file InterpFrame.h.
Referenced by clang::interp::Ret(), and clang::interp::RetVoid().
|
inline |
Returns the current function.
Definition at line 90 of file InterpFrame.h.
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::CheckLiteralType(), clang::interp::cleanupAfterFunctionCall(), clang::interp::Destroy(), dump(), clang::interp::GetTypeidPtr(), clang::interp::Interpret(), 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 98 of file InterpFrame.h.
References clang::T.
Definition at line 248 of file InterpFrame.cpp.
Referenced by clang::interp::Destroy(), clang::interp::GetLocal(), and clang::interp::GetRefLocal().
Returns a pointer to a local variables.
Definition at line 243 of file InterpFrame.cpp.
References Pointer.
Referenced by clang::interp::Destroy(), and clang::interp::GetPtrLocal().
|
inline |
Definition at line 162 of file InterpFrame.h.
References clang::interp::SourceInfo::getLoc(), and getSource().
Referenced by clang::interp::Assume(), clang::interp::CheckCallable(), clang::interp::CheckConstant(), clang::interp::checkConstructor(), CheckGlobal(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLoad(), 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::InterpretOffsetOf(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::ShiftFixedPoint(), and clang::interp::Unsupported().
|
inline |
Definition at line 53 of file InterpFrame.h.
Returns the value of an argument.
Definition at line 114 of file InterpFrame.h.
References clang::interp::Block::deref(), clang::interp::Block::isInitialized(), and clang::T.
Referenced by clang::interp::GetParam().
Returns a pointer to an argument - lazily creates a block.
Definition at line 252 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, clang::T, and TYPE_SWITCH.
Referenced by clang::interp::GetPtrParam().
|
inline |
Definition at line 165 of file InterpFrame.h.
References clang::interp::SourceInfo::getRange(), and getSource().
Referenced by clang::interp::CheckBitCast(), clang::interp::CheckFloatResult(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), clang::interp::CheckLoad(), 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::interp__builtin_strcmp(), clang::interp::InterpretBuiltin(), clang::interp::InterpretOffsetOf(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::PtrPtrCast(), clang::interp::SizelessVectorElementSize(), and clang::interp::Unsupported().
|
inline |
Returns the return address of the opcode in the caller frame.
Definition at line 152 of file InterpFrame.h.
References clang::interp::align().
Referenced by describe(), and getSource().
|
inline |
Returns the return address of the frame.
Definition at line 150 of file InterpFrame.h.
Referenced by 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 279 of file InterpFrame.cpp.
References Caller, funcHasUsableBody(), getRetOpPC(), and clang::Result.
Referenced by clang::interp::addSubOffsetOpaque(), clang::interp::AllocCN(), clang::interp::AllocN(), clang::interp::allowNullSubObj(), clang::interp::ArrayDecay(), clang::interp::BitCastPrim(), clang::interp::CallPtr(), clang::interp::CallVirt(), clang::interp::CheckActive(), clang::interp::CheckArray(), clang::interp::CheckArrayDestSize(), clang::interp::CheckArraySize(), clang::interp::CheckArraySize(), clang::interp::CheckBitCast(), CheckBitcastType(), clang::interp::CheckCallDepth(), clang::interp::CheckConst(), clang::interp::CheckDeleteSource(), clang::interp::checkDestructor(), clang::interp::CheckDivRem(), clang::interp::CheckDummy(), clang::interp::CheckDummy(), clang::interp::CheckDynamicMemoryAllocation(), clang::interp::CheckFloatResult(), clang::interp::CheckFloatStatus(), 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::CheckSubobject(), CheckTemporary(), CheckTemporary(), clang::interp::CMP3(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< MemberPointer >(), clang::interp::CmpHelperEQ< Pointer >(), diagnoseMissingInitializer(), clang::interp::diagnoseNonConstexprBuiltin(), diagnoseNonConstVariable(), clang::interp::diagnoseShiftFailure(), clang::interp::diagnoseTypeIdField(), clang::interp::diagnoseUninitialized(), diagnoseUnknownDecl(), clang::interp::Divc(), clang::interp::DoShift(), clang::interp::DoShiftAP(), clang::interp::DynamicCast(), clang::interp::FnPtrCast(), clang::interp::Free(), clang::interp::getDynamicDecl(), getExpr(), clang::interp::GetIntPtr(), getLocation(), clang::interp::GetPtrDerivedPop(), getRange(), clang::interp::handleReference(), 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::interp__builtin_strcmp(), 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::StartThisLifetime(), clang::interp::StartThisLifetime1(), 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 172 of file InterpFrame.h.
References Caller.
Referenced by clang::interp::CheckLiteralType(), clang::interp::CheckLocalLoad(), clang::interp::CtorCheck(), free(), getParamPointer(), clang::interp::GetPtrParam(), clang::interp::GetPtrThisBase(), clang::interp::GetPtrThisField(), getRVOPtr(), getThis(), clang::interp::InitThisBitField(), clang::interp::InitThisBitFieldActivate(), clang::interp::InitThisField(), clang::interp::InitThisFieldActivate(), and clang::interp::runRecordDestructor().
Definition at line 73 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 297 of file InterpFrame.cpp.
References clang::DeclContext::getParent().
Referenced by clang::interp::InvalidNewDeleteExpr().
|
inline |
Mutates a local variable.
Definition at line 103 of file InterpFrame.h.
References clang::interp::Started, and clang::T.
Referenced by clang::interp::SetLocal().
|
inline |
Mutates a local copy of a parameter.
Definition at line 122 of file InterpFrame.h.
References clang::T.
Referenced by clang::interp::SetParam().
| InterpFrame* clang::interp::InterpFrame::Caller |
The frame of the previous function.
Definition at line 222 of file InterpFrame.h.
Referenced by clang::interp::cleanupAfterFunctionCall(), describe(), dump(), getCaller(), getCallRange(), 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 243 of file InterpFrame.h.
Referenced by clang::interp::CheckCallable(), clang::interp::CheckFunctionDecl(), clang::interp::InvalidNewDeleteExpr(), clang::interp::PopMSVCCE(), and clang::interp::PushMSVCCE().