|
clang 23.0.0git
|
A pointer to a memory block, live or dead. More...
#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/Pointer.h"
Public Member Functions | |
| Pointer () | |
| Pointer (IntPointer &&IntPtr) | |
| Pointer (Block *B) | |
| Pointer (Block *B, uint64_t BaseAndOffset) | |
| Pointer (const Pointer &P) | |
| Pointer (Pointer &&P) | |
| Pointer (uint64_t Address, const Type *Ty, uint64_t Offset=0) | |
| Pointer (const Function *F, uint64_t Offset=0) | |
| Pointer (const Type *TypePtr, const Type *TypeInfoType, uint64_t Offset=0) | |
| Pointer (Block *Pointee, unsigned Base, uint64_t Offset) | |
| Pointer (PtrView V) | |
| ~Pointer () | |
| Pointer & | operator= (const Pointer &P) |
| Pointer & | operator= (Pointer &&P) |
| bool | operator== (const Pointer &P) const |
| Equality operators are just for tests. | |
| bool | operator!= (const Pointer &P) const |
| APValue | toAPValue (const ASTContext &ASTCtx) const |
| Converts the pointer to an APValue. | |
| std::string | toDiagnosticString (const ASTContext &Ctx) const |
| Converts the pointer to a string usable in diagnostics. | |
| uint64_t | getIntegerRepresentation () const |
| PtrView | view () const |
| std::optional< APValue > | toRValue (const Context &Ctx, QualType ResultType) const |
| Converts the pointer to an APValue that is an rvalue. | |
| Pointer | atIndex (uint64_t Idx) const |
| Offsets a pointer inside an array. | |
| Pointer | atField (unsigned Off) const |
| Creates a pointer to a field. | |
| Pointer | atFieldSub (unsigned Off) const |
| Subtract the given offset from the current Base and Offset of the pointer. | |
| Pointer | narrow () const |
| Restricts the scope of an array element pointer. | |
| Pointer | expand () const |
| Expands a pointer to the containing array, undoing narrowing. | |
| bool | isZero () const |
| Checks if the pointer is null. | |
| bool | isLive () const |
| Checks if the pointer is live. | |
| bool | isField () const |
| Checks if the item is a field in an object. | |
| const Descriptor * | getDeclDesc () const |
| Accessor for information about the declaration site. | |
| SourceLocation | getDeclLoc () const |
| DeclTy | getSource () const |
| Returns the expression or declaration the pointer has been created for. | |
| Pointer | getBase () const |
| Returns a pointer to the object of which this pointer is a field. | |
| Pointer | getArray () const |
| Returns the parent array. | |
| const Descriptor * | getFieldDesc () const |
| Accessors for information about the innermost field. | |
| QualType | getType () const |
| Returns the type of the innermost field. | |
| const VarDecl * | getRootVarDecl () const |
| Pointer | getDeclPtr () const |
| size_t | elemSize () const |
| Returns the element size of the innermost field. | |
| size_t | getSize () const |
| Returns the total size of the innermost field. | |
| unsigned | getOffset () const |
| Returns the offset into an array. | |
| bool | isArrayRoot () const |
| Whether this array refers to an array, but not to the first element. | |
| bool | inArray () const |
| Checks if the innermost field is an array. | |
| bool | inUnion () const |
| bool | inPrimitiveArray () const |
| Checks if the structure is a primitive array. | |
| bool | isUnknownSizeArray () const |
| Checks if the structure is an array of unknown size. | |
| bool | isArrayElement () const |
| Checks if the pointer points to an array. | |
| bool | isRoot () const |
| Pointer points directly to a block. | |
| bool | canBeInitialized () const |
| If this pointer has an InlineDescriptor we can use to initialize. | |
| const BlockPointer & | asBlockPointer () const |
| const IntPointer & | asIntPointer () const |
| const FunctionPointer & | asFunctionPointer () const |
| const TypeidPointer & | asTypeidPointer () const |
| bool | isBlockPointer () const |
| bool | isIntegralPointer () const |
| bool | isFunctionPointer () const |
| bool | isTypeidPointer () const |
| const Record * | getRecord () const |
| Returns the record descriptor of a class. | |
| const Record * | getElemRecord () const |
| Returns the element record type, if this is a non-primive array. | |
| const FieldDecl * | getField () const |
| Returns the field information. | |
| bool | isExtern () const |
| Checks if the storage is extern. | |
| bool | isStatic () const |
| Checks if the storage is static. | |
| bool | isTemporary () const |
| Checks if the storage is temporary. | |
| bool | isDynamic () const |
| Checks if the storage has been dynamically allocated. | |
| bool | isStaticTemporary () const |
| Checks if the storage is a static temporary. | |
| bool | isMutable () const |
| Checks if the field is mutable. | |
| bool | isWeak () const |
| bool | isActive () const |
| Checks if the object is active. | |
| bool | isBaseClass () const |
| Checks if a structure is a base class. | |
| bool | isVirtualBaseClass () const |
| bool | isDummy () const |
| Checks if the pointer points to a dummy value. | |
| bool | isConst () const |
| Checks if an object or a subfield is mutable. | |
| bool | isConstInMutable () const |
| bool | isVolatile () const |
| Checks if an object or a subfield is volatile. | |
| UnsignedOrNone | getDeclID () const |
| Returns the declaration ID. | |
| uint64_t | getByteOffset () const |
| Returns the byte offset from the start. | |
| unsigned | getNumElems () const |
| Returns the number of elements. | |
| const Block * | block () const |
| const std::byte * | getRawAddress () const |
| If backed by actual data (i.e. | |
| int64_t | getIndex () const |
| Returns the index into an array. | |
| bool | isOnePastEnd () const |
| Checks if the index is one past end. | |
| bool | isPastEnd () const |
| Checks if the pointer points past the end of the object. | |
| bool | isElementPastEnd () const |
| Checks if the pointer is an out-of-bounds element pointer. | |
| bool | isZeroSizeArray () const |
| Checks if the pointer is pointing to a zero-size array. | |
| bool | canDeref (PrimType T) const |
| Checks whether the pointer can be dereferenced to the given PrimType. | |
| template<typename T> | |
| T & | deref () const |
| Dereferences the pointer, if it's live. | |
| template<typename T> | |
| T & | elem (unsigned I) const |
Dereferences the element at index I. | |
| bool | isConstexprUnknown () const |
| bool | isDereferencable () const |
| Whether this block can be read from at all. | |
| void | initialize () const |
| Initializes a field. | |
| void | initializeElement (unsigned Index) const |
| Initialized the given element of a primitive array. | |
| void | initializeAllElements () const |
| Initialize all elements of a primitive array at once. | |
| bool | isInitialized () const |
| Checks if an object was initialized. | |
| bool | isElementInitialized (unsigned Index) const |
| Like isInitialized(), but for primitive arrays. | |
| bool | allElementsInitialized () const |
| bool | allElementsAlive () const |
| bool | isElementAlive (unsigned Index) const |
| void | activate () const |
| Activates a field. | |
| void | deactivate () const |
| Deactivates an entire strurcutre. | |
| Lifetime | getLifetime () const |
| void | startLifetime () const |
| Start the lifetime of this pointer. | |
| void | endLifetime () const |
| Ends the lifetime of the pointer. | |
| void | setLifeState (Lifetime L) const |
| Pointer | stripBaseCasts () const |
| Strip base casts from this Pointer. | |
| ComparisonCategoryResult | compare (const Pointer &Other) const |
| Compare two pointers. | |
| bool | pointsToLiteral () const |
| Whether this points to a block that's been created for a "literal lvalue", i.e. | |
| bool | pointsToStringLiteral () const |
| bool | pointsToLabel () const |
| Whether this points to a block created for an AddrLabelExpr. | |
| const AddrLabelExpr * | getPointedToLabel () const |
| Returns the AddrLabelExpr the Pointer points to, if any. | |
| void | print (llvm::raw_ostream &OS) const |
| Prints the pointer. | |
| std::optional< size_t > | computeOffsetForComparison (const ASTContext &ASTCtx) const |
| Compute an integer that can be used to compare this pointer to another one. | |
Static Public Member Functions | |
| static bool | hasSameBase (const Pointer &A, const Pointer &B) |
| Checks if two pointers are comparable. | |
| static bool | hasSameArray (const Pointer &A, const Pointer &B) |
| Checks if two pointers can be subtracted. | |
| static bool | pointToSameBlock (const Pointer &A, const Pointer &B) |
| Checks if both given pointers point to the same block. | |
| static std::optional< std::pair< PtrView, PtrView > > | computeSplitPoint (const Pointer &A, const Pointer &B) |
Friends | |
| class | Block |
| class | DeadBlock |
| class | MemberPointer |
| class | InterpState |
| class | DynamicAllocator |
| class | Program |
A pointer to a memory block, live or dead.
This object can be allocated into interpreter stack frames. If pointing to a live block, it is a link in the chain of pointers pointing to the block.
In the simplest form, a Pointer has a Block* (the pointee) and both Base and Offset are 0, which means it will point to raw data.
The Base field is used to access metadata about the data. For primitive arrays, the Base is followed by an InitMap. In a variety of cases, the Base is preceded by an InlineDescriptor, which is used to track the initialization state, among other things.
The Offset field is used to access the actual data. In other words, the data the pointer decribes can be found at Pointee->rawData() + Pointer.Offset.
/// Pointee Offset /// │ │ /// │ │ /// ▼ ▼ /// ┌───────┬────────────┬─────────┬────────────────────────────┐ /// │ Block │ InlineDesc │ InitMap │ Actual Data │ /// └───────┴────────────┴─────────┴────────────────────────────┘ /// ▲ /// │ /// │ /// Base ///
|
inline |
Definition at line 396 of file Pointer.h.
References Int, and clang::nullptr.
Referenced by atField(), atFieldSub(), atIndex(), compare(), computeSplitPoint(), expand(), getArray(), getBase(), getDeclPtr(), hasSameArray(), hasSameBase(), narrow(), operator!=(), operator=(), operator=(), operator==(), Pointer(), Pointer(), Pointer(), Pointer(), Pointer(), pointToSameBlock(), and stripBaseCasts().
|
inline |
| Pointer::Pointer | ( | Block * | B | ) |
Definition at line 28 of file Pointer.cpp.
| Pointer::Pointer | ( | Block * | B, |
| uint64_t | BaseAndOffset ) |
Definition at line 32 of file Pointer.cpp.
| Pointer::Pointer | ( | const Pointer & | P | ) |
Definition at line 45 of file Pointer.cpp.
References clang::interp::Block, BS, Fn, clang::interp::Fn, Int, clang::interp::Int, Pointer(), Typeid, and clang::interp::Typeid.
| Pointer::Pointer | ( | Pointer && | P | ) |
Definition at line 65 of file Pointer.cpp.
References clang::interp::Block, BS, Fn, clang::interp::Fn, Int, clang::interp::Int, Pointer(), Typeid, and clang::interp::Typeid.
|
inline |
Definition at line 403 of file Pointer.h.
References clang::interp::Address, and Int.
|
inline |
Definition at line 35 of file Pointer.cpp.
References Block, BS, clang::interp::Block::getDescriptor(), and clang::interp::Descriptor::getMetadataSize().
|
inlineexplicit |
| Pointer::~Pointer | ( | ) |
Definition at line 84 of file Pointer.cpp.
References Block, BS, and isBlockPointer().
|
inline |
Activates a field.
Definition at line 940 of file Pointer.h.
References clang::interp::PtrView::activate(), and view().
Referenced by clang::interp::Activate(), clang::interp::ActivateThisField(), clang::interp::CheckNewTypeMismatch(), clang::interp::FinishInitActivate(), clang::interp::FinishInitActivatePop(), and clang::interp::FinishInitGlobal().
| bool Pointer::allElementsAlive | ( | ) | const |
Definition at line 619 of file Pointer.cpp.
References clang::interp::InitMap::allElementsAlive(), clang::interp::InitMapPtr::allInitialized(), block(), BS, clang::interp::Block::getBlockDesc(), getFieldDesc(), clang::interp::InitMapPtr::hasInitMap(), clang::interp::Initialized, clang::interp::GlobalInlineDescriptor::InitState, isArrayRoot(), isRoot(), and isStatic().
|
inline |
Definition at line 931 of file Pointer.h.
References clang::interp::PtrView::allElementsInitialized(), getFieldDesc(), isArrayRoot(), and view().
|
inlinenodiscard |
Definition at line 651 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by computeSplitPoint(), clang::interp::DeadBlock::DeadBlock(), hasSameBase(), isInitialized(), and clang::interp::OffsetHelper().
|
inlinenodiscard |
Definition at line 659 of file Pointer.h.
References Fn, and isFunctionPointer().
Referenced by clang::interp::CallPtr(), clang::interp::CastPointerIntegral(), clang::interp::OffsetHelper(), and toAPValue().
|
inlinenodiscard |
Definition at line 655 of file Pointer.h.
References Int, and isIntegralPointer().
Referenced by clang::interp::getBase(), clang::interp::getField(), clang::interp::OffsetHelper(), toAPValue(), and toDiagnosticString().
|
inlinenodiscard |
Definition at line 663 of file Pointer.h.
References isTypeidPointer(), and Typeid.
Referenced by computeOffsetForComparison(), and print().
Creates a pointer to a field.
Definition at line 470 of file Pointer.h.
References atField(), Pointer(), and view().
Referenced by clang::interp::ActivateThisField(), atField(), clang::interp::finishGlobalRecurse(), clang::interp::getBase(), clang::interp::MemberPointer::getBase(), clang::interp::GetField(), clang::interp::getField(), clang::interp::GetFieldPop(), clang::interp::InitBitField(), clang::interp::InitBitFieldActivate(), clang::interp::InitField(), clang::interp::InitFieldActivate(), clang::interp::SetField(), and clang::interp::MemberPointer::toPointer().
Subtract the given offset from the current Base and Offset of the pointer.
Definition at line 476 of file Pointer.h.
Referenced by clang::interp::MemberPointer::getBase(), and clang::interp::GetPtrDerivedPop().
|
inlinenodiscard |
Offsets a pointer inside an array.
Definition at line 460 of file Pointer.h.
References atIndex(), Fn, Int, isFunctionPointer(), isIntegralPointer(), Pointer(), and view().
Referenced by clang::interp::ArrayDecay(), clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), atIndex(), clang::interp::BitCast(), clang::interp::CopyArray(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::finishGlobalRecurse(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_nan(), clang::interp::OffsetHelper(), and clang::interp::RunDestructors().
|
inline |
Definition at line 803 of file Pointer.h.
Referenced by allElementsAlive(), clang::interp::CallVirt(), clang::interp::CastPointerIntegral(), clang::interp::CheckConst(), clang::interp::CheckDeleteSource(), clang::interp::CheckDestructor(), clang::interp::CheckFinalLoad(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), clang::interp::CheckLoad(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckStore(), clang::interp::CheckVolatile(), clang::interp::collectBlocks(), clang::interp::DiagnoseUninitialized(), clang::interp::Program::dump(), clang::interp::Free(), clang::interp::getField(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::interp__builtin_operator_delete(), clang::interp::interp__builtin_strlen(), clang::interp::isConstexprUnknown(), isInitialized(), clang::interp::operator<<(), operator=(), pointsToLiteral(), pointsToStringLiteral(), pointToSameBlock(), toAPValue(), and clang::interp::MemberPointer::toPointer().
|
inline |
If this pointer has an InlineDescriptor we can use to initialize.
Definition at line 644 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::Activate(), clang::interp::ActivateThisField(), clang::interp::FinishInit(), clang::interp::FinishInitActivate(), clang::interp::FinishInitActivatePop(), clang::interp::FinishInitGlobal(), clang::interp::FinishInitPop(), clang::interp::interp__builtin_carryop(), and clang::interp::interp__builtin_overflowop().
Checks whether the pointer can be dereferenced to the given PrimType.
Definition at line 855 of file Pointer.h.
References getFieldDesc().
Referenced by clang::interp::Load(), clang::interp::LoadPop(), and toRValue().
|
inline |
Compare two pointers.
Definition at line 995 of file Pointer.h.
References clang::Equal, clang::Greater, hasSameBase(), clang::Less, clang::Other, Pointer(), and clang::Unordered.
| std::optional< size_t > Pointer::computeOffsetForComparison | ( | const ASTContext & | ASTCtx | ) | const |
Compute an integer that can be used to compare this pointer to another one.
Compute an offset that can be used to compare the pointer to another one with the same base.
This is usually NOT the same as the pointer offset regarding the AST record layout.
To get accurate results, we basically have to compute the lvalue offset using the ASTRecordLayout.
This function will fail if we're trying to get the type size of a forward declaration.
Definition at line 363 of file Pointer.cpp.
References asTypeidPointer(), clang::interp::Block, clang::interp::PtrView::elemSize(), clang::interp::PtrView::expand(), clang::interp::Fn, clang::interp::PtrView::getArray(), clang::ASTContext::getASTRecordLayout(), clang::interp::PtrView::getBase(), clang::interp::PtrView::getDeclDesc(), clang::interp::PtrView::getField(), clang::FieldDecl::getFieldIndex(), clang::ASTRecordLayout::getFieldOffset(), clang::interp::PtrView::getIndex(), clang::interp::PtrView::getInlineDesc(), getIntegerRepresentation(), clang::CharUnits::getQuantity(), clang::interp::PtrView::getRecord(), clang::interp::Descriptor::getType(), clang::ValueDecl::getType(), clang::ASTContext::getTypeSizeInChars(), Int, clang::interp::Int, clang::interp::PtrView::isArrayElement(), clang::interp::PtrView::isBaseClass(), clang::interp::PtrView::isOnePastEnd(), clang::interp::PtrView::isRoot(), clang::interp::PtrView::isVirtualBaseClass(), clang::interp::InlineDescriptor::Offset, clang::Result, clang::ASTContext::toCharUnitsFromBits(), clang::interp::Typeid, clang::interp::TypeidPointer::TypePtr, and view().
Referenced by clang::interp::CmpHelper< Pointer >(), and clang::interp::CmpHelperEQ< Pointer >().
|
static |
Definition at line 757 of file Pointer.cpp.
References asBlockPointer(), clang::interp::PtrView::Base, getBase(), clang::interp::PtrView::getFieldDesc(), clang::interp::Descriptor::isArray(), isBlockPointer(), isRoot(), clang::interp::PtrView::isRoot(), clang::interp::BlockPointer::Pointee, Pointer(), and view().
Referenced by clang::interp::CmpHelper< Pointer >().
|
inline |
|
inline |
Dereferences the pointer, if it's live.
Definition at line 864 of file Pointer.h.
References BS, clang::interp::PtrView::deref(), isBlockPointer(), isDereferencable(), isLive(), and view().
Referenced by clang::interp::assignIntegral(), clang::interp::copyPrimitiveMemory(), clang::interp::copyPrimitiveMemory(), clang::interp::finishGlobalRecurse(), clang::interp::IncDecFloatHelper(), clang::interp::IncDecHelper(), clang::interp::IncDecPtrHelper(), clang::interp::InitField(), clang::interp::InitFieldActivate(), clang::interp::InitGlobal(), clang::interp::InitGlobalTemp(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_memchr(), clang::interp::Load(), clang::interp::LoadPop(), clang::interp::StoreActivate(), clang::interp::StoreActivatePop(), clang::interp::StoreBitFieldActivate(), clang::interp::StoreBitFieldActivatePop(), and toRValue().
|
inline |
Dereferences the element at index I.
This is equivalent to atIndex(I).deref<T>().
Definition at line 876 of file Pointer.h.
References BS, clang::interp::PtrView::elem(), getFieldDesc(), getNumElems(), isBlockPointer(), isDereferencable(), isLive(), and view().
Referenced by clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), clang::interp::convertBoolVectorToInt(), clang::interp::CopyArray(), clang::interp::Program::createGlobalString(), clang::interp::Divc(), clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), clang::interp::interp__builtin_elementwise_abs(), clang::interp::interp__builtin_elementwise_fp_binop(), clang::interp::interp__builtin_elementwise_int_binop(), clang::interp::interp__builtin_elementwise_int_unaryop(), clang::interp::interp__builtin_elementwise_maxmin(), clang::interp::interp__builtin_elementwise_triop(), clang::interp::interp__builtin_elementwise_triop_fp(), clang::interp::interp__builtin_ia32_addsub(), clang::interp::interp__builtin_ia32_cmp_mask(), clang::interp::interp__builtin_ia32_cvt_mask2vec(), clang::interp::interp__builtin_ia32_cvt_vec2mask(), clang::interp::interp__builtin_ia32_cvtpd2ps(), clang::interp::interp__builtin_ia32_cvtsd2ss(), clang::interp::interp__builtin_ia32_dbpsadbw(), clang::interp::interp__builtin_ia32_extract_vector(), clang::interp::interp__builtin_ia32_extract_vector_masked(), clang::interp::interp__builtin_ia32_gfni_affine(), clang::interp::interp__builtin_ia32_gfni_mul(), clang::interp::interp__builtin_ia32_insert_subvector(), clang::interp::interp__builtin_ia32_mpsadbw(), clang::interp::interp__builtin_ia32_multishiftqb(), clang::interp::interp__builtin_ia32_pack(), clang::interp::interp__builtin_ia32_pclmulqdq(), clang::interp::interp__builtin_ia32_pmul(), clang::interp::interp__builtin_ia32_select(), clang::interp::interp__builtin_ia32_select_scalar(), clang::interp::interp__builtin_ia32_shift_with_count(), clang::interp::interp__builtin_ia32_shufbitqmb_mask(), clang::interp::interp__builtin_ia32_shuffle_generic(), clang::interp::interp__builtin_ia32_test_op(), clang::interp::interp__builtin_ia32_vcvtps2ph(), clang::interp::interp__builtin_ia32_vec_ext(), clang::interp::interp__builtin_ia32_vec_set(), clang::interp::interp__builtin_ia32_vpconflict(), clang::interp::interp__builtin_ia32_vpdp(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_scalar_fp_round_mask_binop(), clang::interp::interp__builtin_vector_reduce(), clang::interp::interp_builtin_horizontal_fp_binop(), clang::interp::interp_builtin_horizontal_int_binop(), and clang::interp::Mulc().
|
inline |
Returns the element size of the innermost field.
Definition at line 582 of file Pointer.h.
References clang::interp::PtrView::elemSize(), isIntegralPointer(), and view().
Referenced by clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), and getIntegerRepresentation().
|
inline |
Ends the lifetime of the pointer.
This works for pointer with an InlineDescriptor as well as primitive array elements. This function is used by std::destroy_at.
Definition at line 976 of file Pointer.h.
References clang::interp::Ended, and setLifeState().
|
inlinenodiscard |
Expands a pointer to the containing array, undoing narrowing.
Definition at line 490 of file Pointer.h.
References expand(), isBlockPointer(), Pointer(), and view().
Referenced by clang::interp::computePointerOffset(), clang::interp::evaluateBuiltinObjectSize(), expand(), clang::interp::ExpandPtr(), clang::interp::Free(), clang::interp::interp__builtin_memcpy(), clang::interp::operator<<(), and clang::interp::pointsToLastObject().
|
inlinenodiscard |
Returns the parent array.
Definition at line 550 of file Pointer.h.
References getArray(), Pointer(), and view().
Referenced by clang::interp::computePointerOffset(), getArray(), getLifetime(), clang::interp::operator<<(), and clang::interp::pointsToLastObject().
|
inlinenodiscard |
Returns a pointer to the object of which this pointer is a field.
Definition at line 548 of file Pointer.h.
References getBase(), Pointer(), and view().
Referenced by clang::interp::CheckActive(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckVolatile(), clang::interp::computePointerOffset(), computeSplitPoint(), clang::interp::evaluateBuiltinObjectSize(), getBase(), and clang::interp::pointsToLastObject().
|
inline |
Returns the byte offset from the start.
Definition at line 786 of file Pointer.h.
References Int, isIntegralPointer(), isOnePastEnd(), isTypeidPointer(), clang::interp::PtrView::PastEndMark, and Typeid.
Referenced by clang::interp::CheckDowncast(), clang::interp::getField(), and clang::interp::OffsetHelper().
|
inline |
Accessor for information about the declaration site.
Definition at line 525 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::arePotentiallyOverlappingStringLiterals(), clang::interp::CastPointerIntegral(), clang::interp::CheckBCPResult(), clang::interp::CheckConstant(), clang::interp::CheckDowncast(), clang::interp::CheckExtern(), clang::interp::InterpState::checkingConstantDestruction(), clang::interp::CheckLiteralType(), clang::interp::diagnoseOutOfLifetimeDestroy(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Free(), getDeclLoc(), getFieldDesc(), getPointedToLabel(), clang::interp::GetPtrDerivedPop(), getRootVarDecl(), getSource(), clang::interp::InitGlobalTemp(), clang::interp::InitGlobalTempComp(), clang::interp::interp__builtin_assume_aligned(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::interp__builtin_operator_delete(), isConst(), isConstexprUnknown(), isVolatile(), toAPValue(), and clang::interp::Context::tryEvaluateObjectSize().
|
inline |
Returns the declaration ID.
Definition at line 777 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::CheckConstant(), and CheckGlobal().
|
inline |
Definition at line 533 of file Pointer.h.
References getDeclDesc(), and clang::interp::Descriptor::getLocation().
|
inlinenodiscard |
Definition at line 579 of file Pointer.h.
Referenced by clang::interp::CheckDowncast(), and toAPValue().
|
inline |
Returns the element record type, if this is a non-primive array.
Definition at line 680 of file Pointer.h.
References clang::interp::PtrView::getElemRecord(), and view().
|
inline |
Returns the field information.
Definition at line 682 of file Pointer.h.
References getFieldDesc().
Referenced by clang::interp::CheckVolatile(), clang::interp::computePointerOffset(), and clang::interp::pointsToLastObject().
|
inline |
Accessors for information about the innermost field.
Definition at line 553 of file Pointer.h.
References getDeclDesc(), isIntegralPointer(), and isRoot().
Referenced by allElementsAlive(), allElementsInitialized(), clang::interp::arePotentiallyOverlappingStringLiterals(), clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), clang::interp::BitCast(), clang::interp::CallVirt(), canDeref(), clang::interp::CheckConst(), clang::interp::checkConstructor(), clang::interp::CheckLoad(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckVolatile(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::computePointerOffset(), clang::interp::convertBoolVectorToInt(), clang::interp::CopyArray(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), clang::interp::DoMemcpy(), elem(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), clang::interp::finishGlobalRecurse(), clang::interp::getBase(), clang::interp::getElemType(), clang::interp::GetField(), clang::interp::getField(), getField(), clang::interp::GetFieldPop(), clang::interp::GetPtrDerivedPop(), getSize(), hasSameArray(), initializeAllElements(), clang::interp::interp__builtin_elementwise_abs(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_elementwise_int_unaryop(), clang::interp::interp__builtin_ia32_cvt_mask2vec(), clang::interp::interp__builtin_ia32_cvt_vec2mask(), clang::interp::interp__builtin_ia32_extract_vector(), clang::interp::interp__builtin_ia32_extract_vector_masked(), clang::interp::interp__builtin_ia32_insert_subvector(), clang::interp::interp__builtin_ia32_select(), clang::interp::interp__builtin_ia32_vcvtps2ph(), clang::interp::interp__builtin_ia32_vec_ext(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_operator_delete(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::interp__builtin_vector_reduce(), isElementAlive(), isInitialized(), isUnknownSizeArray(), clang::interp::isUserWritingOffTheEnd(), isZeroSizeArray(), clang::interp::OffsetHelper(), clang::interp::operator<<(), toAPValue(), and clang::interp::VirtBaseHelper().
|
inline |
Returns the index into an array.
Definition at line 813 of file Pointer.h.
References clang::interp::PtrView::getIndex(), getIntegerRepresentation(), isBlockPointer(), and view().
Referenced by clang::interp::arePotentiallyOverlappingStringLiterals(), clang::interp::CheckBCPResult(), clang::interp::CheckPointerToIntegralCast(), clang::interp::computePointerOffset(), clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), clang::interp::Free(), getLifetime(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), isInitialized(), clang::interp::OffsetHelper(), clang::interp::operator<<(), and clang::interp::SubPtr().
|
inline |
Definition at line 442 of file Pointer.h.
References BS, elemSize(), Fn, Int, isFunctionPointer(), and isIntegralPointer().
Referenced by clang::interp::CastPointerIntegral(), clang::interp::CastPointerIntegralAP(), clang::interp::CastPointerIntegralAPS(), clang::interp::CmpHelperEQ< Pointer >(), computeOffsetForComparison(), getIndex(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::interp__builtin_memcpy(), clang::interp::OffsetHelper(), and clang::interp::SubPtr().
|
inline |
Definition at line 946 of file Pointer.h.
References clang::interp::InitMapPtr::allInitialized(), BS, clang::interp::Ended, getArray(), getIndex(), getLifetime(), clang::interp::InitMapPtr::hasInitMap(), inArray(), isArrayRoot(), isBlockPointer(), clang::interp::InitMap::isElementAlive(), and clang::interp::Started.
Referenced by clang::interp::CheckDestructor(), clang::interp::CheckLifetime(), clang::interp::Destroy(), clang::interp::diagnoseOutOfLifetimeDestroy(), getLifetime(), and clang::interp::interp__builtin_is_within_lifetime().
|
inline |
Returns the number of elements.
Definition at line 797 of file Pointer.h.
References clang::interp::PtrView::getNumElems(), isBlockPointer(), and view().
Referenced by clang::interp::arePotentiallyOverlappingStringLiterals(), clang::interp::CheckArrayDestSize(), clang::interp::computePointerOffset(), clang::interp::convertBoolVectorToInt(), elem(), clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), clang::interp::interp__builtin_elementwise_abs(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_elementwise_int_unaryop(), clang::interp::interp__builtin_ia32_cmp_mask(), clang::interp::interp__builtin_ia32_cvt_mask2vec(), clang::interp::interp__builtin_ia32_cvt_vec2mask(), clang::interp::interp__builtin_ia32_cvtpd2ps(), clang::interp::interp__builtin_ia32_extract_vector(), clang::interp::interp__builtin_ia32_extract_vector_masked(), clang::interp::interp__builtin_ia32_gfni_mul(), clang::interp::interp__builtin_ia32_insert_subvector(), clang::interp::interp__builtin_ia32_movmsk_op(), clang::interp::interp__builtin_ia32_phminposuw(), clang::interp::interp__builtin_ia32_pternlog(), clang::interp::interp__builtin_ia32_select(), clang::interp::interp__builtin_ia32_test_op(), clang::interp::interp__builtin_ia32_vec_ext(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_vector_reduce(), clang::interp::OffsetHelper(), and clang::interp::SubPtr().
|
inline |
Returns the offset into an array.
Definition at line 597 of file Pointer.h.
References clang::interp::PtrView::getOffset(), clang::interp::PtrView::PastEndMark, and view().
Referenced by clang::interp::CmpHelperEQ< Pointer >(), and isOnePastEnd().
|
inline |
Returns the AddrLabelExpr the Pointer points to, if any.
Definition at line 1024 of file Pointer.h.
References getDeclDesc().
Referenced by clang::interp::SubPtr().
|
inline |
If backed by actual data (i.e.
a block pointer), return an address to that data.
Definition at line 807 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::Context::evaluateString(), and clang::interp::Context::evaluateStrlen().
|
inline |
Returns the record descriptor of a class.
Definition at line 674 of file Pointer.h.
References clang::interp::PtrView::getRecord(), isBlockPointer(), and view().
Referenced by clang::interp::CheckActive(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckNewTypeMismatch(), clang::interp::computePointerOffset(), clang::interp::finishGlobalRecurse(), clang::interp::GetPtrDerivedPop(), clang::interp::Memcpy(), clang::interp::pointsToLastObject(), clang::interp::SetThreeWayComparisonField(), and clang::interp::MemberPointer::toPointer().
| const VarDecl * Pointer::getRootVarDecl | ( | ) | const |
Definition at line 998 of file Pointer.cpp.
References clang::interp::Descriptor::asVarDecl(), getDeclDesc(), and isBlockPointer().
Referenced by clang::interp::getDynamicDecl().
|
inline |
Returns the total size of the innermost field.
Definition at line 591 of file Pointer.h.
References getFieldDesc(), clang::interp::Descriptor::getSize(), and isBlockPointer().
Referenced by isOnePastEnd().
|
inline |
Returns the expression or declaration the pointer has been created for.
Definition at line 536 of file Pointer.h.
References Fn, clang::interp::Function::getDecl(), getDeclDesc(), clang::interp::Descriptor::getSource(), isBlockPointer(), and isFunctionPointer().
|
inline |
Returns the type of the innermost field.
Definition at line 563 of file Pointer.h.
References clang::interp::Block, Fn, clang::interp::Fn, clang::interp::PtrView::getType(), Int, clang::interp::Int, Typeid, clang::interp::Typeid, and view().
Referenced by clang::interp::CheckBCPResult(), clang::interp::CheckConst(), clang::interp::CheckDowncast(), clang::interp::EvaluationResult::checkDynamicAllocations(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckVolatile(), clang::interp::DoBitCastPtr(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Free(), clang::interp::getDynamicDecl(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::SubPtr(), and toDiagnosticString().
Checks if two pointers can be subtracted.
Definition at line 720 of file Pointer.cpp.
References clang::interp::BlockPointer::Base, BS, getFieldDesc(), hasSameBase(), clang::interp::Descriptor::IsArray, and Pointer().
Checks if two pointers are comparable.
Definition at line 696 of file Pointer.cpp.
References asBlockPointer(), isFunctionPointer(), isIntegralPointer(), isTypeidPointer(), isZero(), clang::interp::BlockPointer::Pointee, and Pointer().
Referenced by clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), compare(), hasSameArray(), and clang::interp::SubPtr().
|
inline |
Checks if the innermost field is an array.
Definition at line 607 of file Pointer.h.
References clang::interp::PtrView::inArray(), isBlockPointer(), and view().
Referenced by clang::interp::evaluateBuiltinObjectSize(), getLifetime(), and clang::interp::OffsetHelper().
|
inline |
Initializes a field.
Definition at line 909 of file Pointer.h.
References clang::interp::PtrView::initialize(), isBlockPointer(), and view().
Referenced by clang::interp::FinishInit(), clang::interp::FinishInitActivate(), clang::interp::FinishInitActivatePop(), clang::interp::FinishInitGlobal(), clang::interp::FinishInitPop(), clang::interp::Init(), clang::interp::InitGlobal(), clang::interp::InitGlobalTemp(), clang::interp::InitPop(), clang::interp::interp__builtin_carryop(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_overflowop(), clang::interp::SetField(), clang::interp::Store(), clang::interp::StoreBitField(), clang::interp::StoreBitFieldPop(), and clang::interp::StorePop().
| void Pointer::initializeAllElements | ( | ) | const |
Initialize all elements of a primitive array at once.
This can be used in situations where we know we have initialized all elements of a primtive array.
Definition at line 596 of file Pointer.cpp.
References getFieldDesc(), and isArrayRoot().
Referenced by clang::interp::Program::createGlobalString(), clang::interp::interp__builtin_elementwise_abs(), clang::interp::interp__builtin_elementwise_fp_binop(), clang::interp::interp__builtin_elementwise_int_binop(), clang::interp::interp__builtin_elementwise_int_unaryop(), clang::interp::interp__builtin_elementwise_triop(), clang::interp::interp__builtin_elementwise_triop_fp(), clang::interp::interp__builtin_ia32_cvt_mask2vec(), clang::interp::interp__builtin_ia32_cvtpd2ps(), clang::interp::interp__builtin_ia32_cvtsd2ss(), clang::interp::interp__builtin_ia32_extract_vector(), clang::interp::interp__builtin_ia32_extract_vector_masked(), clang::interp::interp__builtin_ia32_insert_subvector(), clang::interp::interp__builtin_ia32_multishiftqb(), clang::interp::interp__builtin_ia32_select(), clang::interp::interp__builtin_ia32_select_scalar(), clang::interp::interp__builtin_ia32_shift_with_count(), clang::interp::interp__builtin_ia32_shuffle_generic(), clang::interp::interp__builtin_ia32_vec_set(), clang::interp::interp__builtin_ia32_vpconflict(), and clang::interp::interp__builtin_ia32_vpdp().
|
inline |
Initialized the given element of a primitive array.
Definition at line 915 of file Pointer.h.
References clang::interp::PtrView::initializeElement(), and view().
Referenced by clang::interp::CopyArray().
|
inline |
Checks if the structure is a primitive array.
Definition at line 619 of file Pointer.h.
References clang::interp::PtrView::inPrimitiveArray(), isBlockPointer(), and view().
|
inline |
Definition at line 612 of file Pointer.h.
References BS, clang::interp::PtrView::inUnion(), isBlockPointer(), and view().
Referenced by clang::interp::CheckActive(), and clang::interp::CheckNewTypeMismatch().
|
inline |
Checks if the object is active.
Definition at line 741 of file Pointer.h.
References clang::interp::PtrView::isActive(), isBlockPointer(), and view().
Referenced by clang::interp::CheckActive(), clang::interp::CheckNewTypeMismatch(), and clang::interp::interp__builtin_is_within_lifetime().
|
inline |
Checks if the pointer points to an array.
Definition at line 631 of file Pointer.h.
References clang::interp::PtrView::isArrayElement(), isBlockPointer(), and view().
Referenced by clang::interp::EvaluationResult::checkDynamicAllocations(), clang::interp::CheckNewTypeMismatch(), clang::interp::computePointerOffset(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Free(), clang::interp::operator<<(), and clang::interp::pointsToLastObject().
|
inline |
Whether this array refers to an array, but not to the first element.
Definition at line 604 of file Pointer.h.
References clang::interp::PtrView::isArrayRoot(), and view().
Referenced by allElementsAlive(), allElementsInitialized(), clang::interp::BitCast(), clang::interp::CheckLoad(), getLifetime(), initializeAllElements(), and clang::interp::operator<<().
|
inline |
Checks if a structure is a base class.
Definition at line 747 of file Pointer.h.
References clang::interp::PtrView::isBaseClass(), and view().
Referenced by clang::interp::computePointerOffset(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::operator<<(), and clang::interp::pointsToLastObject().
|
inline |
Definition at line 668 of file Pointer.h.
References clang::interp::Block.
Referenced by asBlockPointer(), clang::interp::CallVirt(), canBeInitialized(), clang::interp::CastPointerIntegral(), clang::interp::CheckConst(), clang::interp::CheckConstant(), clang::interp::EvaluationResult::checkDynamicAllocations(), clang::interp::CheckFinalLoad(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckLoad(), clang::interp::CheckMutable(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckRange(), clang::interp::CheckStore(), clang::interp::CmpHelperEQ< Pointer >(), computeSplitPoint(), clang::interp::CopyArray(), deref(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), clang::interp::DoMemcpy(), clang::interp::DoMemcpy(), elem(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Context::evaluateString(), clang::interp::Context::evaluateStrlen(), expand(), clang::interp::ExpandPtr(), clang::interp::Free(), clang::interp::getBase(), getDeclDesc(), getDeclID(), clang::interp::getField(), getIndex(), getLifetime(), getNumElems(), clang::interp::GetPtrDerivedPop(), getRawAddress(), getRecord(), getRootVarDecl(), getSize(), getSource(), inArray(), initialize(), inPrimitiveArray(), clang::interp::interp__builtin_assume_aligned(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_overflowop(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), inUnion(), isActive(), isArrayElement(), clang::interp::isConstexprUnknown(), isConstexprUnknown(), isConstInMutable(), isDereferencable(), isDummy(), isDynamic(), isElementInitialized(), isExtern(), isField(), isInitialized(), isLive(), isMutable(), isOnePastEnd(), clang::interp::isReadable(), isRoot(), isStatic(), isTemporary(), isUnknownSizeArray(), isVolatile(), isWeak(), clang::interp::Load(), clang::interp::LoadPop(), narrow(), clang::interp::OffsetHelper(), clang::interp::operator<<(), operator=(), operator=(), pointsToLabel(), pointsToLiteral(), pointsToStringLiteral(), pointToSameBlock(), setLifeState(), clang::interp::SubPtr(), view(), clang::interp::VirtBaseHelper(), and ~Pointer().
|
inline |
Checks if an object or a subfield is mutable.
Definition at line 758 of file Pointer.h.
References getDeclDesc(), clang::interp::Descriptor::IsConst, isIntegralPointer(), and isRoot().
Referenced by clang::interp::CheckConst(), clang::interp::CheckExtern(), clang::interp::Context::evaluateString(), and clang::interp::getDynamicDecl().
|
inline |
Definition at line 887 of file Pointer.h.
References getDeclDesc(), isBlockPointer(), and clang::interp::Descriptor::IsConstexprUnknown.
Referenced by clang::interp::CheckExtern(), clang::interp::CheckFinalLoad(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::interp__builtin_strlen(), isDereferencable(), and toAPValue().
|
inline |
Definition at line 763 of file Pointer.h.
References false, isBlockPointer(), and isRoot().
Referenced by clang::interp::CheckConst().
|
inline |
Whether this block can be read from at all.
This is only true for block pointers that point to a valid location inside that block.
Definition at line 895 of file Pointer.h.
References isBlockPointer(), isConstexprUnknown(), isDummy(), and isPastEnd().
Referenced by deref(), elem(), and clang::interp::IncDecPtrHelper().
|
inline |
Checks if the pointer points to a dummy value.
Definition at line 751 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isDummy(), and view().
Referenced by clang::interp::Call(), clang::interp::CastPointerIntegral(), clang::interp::CheckBCPResult(), clang::interp::CheckInvoke(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CopyArray(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Context::evaluateStrlen(), clang::interp::IncDecHelper(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_overflowop(), clang::interp::interp__builtin_strcmp(), isDereferencable(), clang::interp::isReadable(), and toRValue().
|
inline |
Checks if the storage has been dynamically allocated.
Definition at line 710 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::CheckLive(), pointsToLiteral(), pointsToStringLiteral(), and toAPValue().
Definition at line 500 of file Pointer.cpp.
References clang::interp::InitMapPtr::allInitialized(), getFieldDesc(), clang::interp::InitMapPtr::hasInitMap(), and clang::interp::InitMap::isElementAlive().
Like isInitialized(), but for primitive arrays.
Definition at line 925 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isElementInitialized(), and view().
Referenced by clang::interp::interp__builtin_nan(), and isInitialized().
|
inline |
Checks if the pointer is an out-of-bounds element pointer.
Definition at line 843 of file Pointer.h.
References clang::interp::PtrView::PastEndMark.
Referenced by clang::interp::CheckRange(), clang::interp::interp__builtin_is_aligned_up_down(), print(), and clang::interp::SubPtr().
|
inline |
Checks if the storage is extern.
Definition at line 689 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by clang::interp::CheckExtern(), and clang::interp::DiagnoseUninitialized().
|
inline |
Checks if the item is a field in an object.
Definition at line 517 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isField(), and view().
Referenced by clang::interp::CheckLive(), clang::interp::CheckLoad(), and clang::interp::computePointerOffset().
|
inline |
Definition at line 670 of file Pointer.h.
References clang::interp::Fn.
Referenced by asFunctionPointer(), atIndex(), clang::interp::CallPtr(), clang::interp::CastPointerIntegral(), clang::interp::CheckBCPResult(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), getIntegerRepresentation(), getSource(), hasSameBase(), isWeak(), isZeroSizeArray(), clang::interp::OffsetHelper(), operator==(), and toAPValue().
| bool Pointer::isInitialized | ( | ) | const |
Checks if an object was initialized.
Definition at line 453 of file Pointer.cpp.
References asBlockPointer(), block(), BS, clang::interp::Block::getBlockDesc(), getFieldDesc(), getIndex(), clang::interp::Initialized, clang::interp::GlobalInlineDescriptor::InitState, isBlockPointer(), isElementInitialized(), clang::interp::Descriptor::isPrimitiveArray(), and isRoot().
Referenced by clang::interp::CheckExtern(), clang::interp::CheckFinalLoad(), clang::interp::CheckLoad(), clang::interp::DecPtr(), clang::interp::DiagnoseUninitialized(), clang::interp::Program::dump(), clang::interp::IncPtr(), and clang::interp::Program::isGlobalInitialized().
|
inline |
Definition at line 669 of file Pointer.h.
References clang::interp::Int.
Referenced by asIntPointer(), atIndex(), clang::interp::CheckBCPResult(), clang::interp::CheckPointerToIntegralCast(), elemSize(), clang::interp::getBase(), getByteOffset(), clang::interp::getField(), getFieldDesc(), getIntegerRepresentation(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::interp__builtin_memcpy(), isConst(), isPastEnd(), clang::interp::OffsetHelper(), operator==(), toAPValue(), toDiagnosticString(), and toRValue().
|
inline |
Checks if the pointer is live.
Definition at line 511 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isLive(), and view().
Referenced by clang::interp::CheckConst(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckLive(), clang::interp::CheckVolatile(), deref(), clang::interp::DiagnoseUninitialized(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), elem(), clang::interp::isReadable(), clang::interp::operator<<(), and toRValue().
|
inline |
Checks if the field is mutable.
Definition at line 721 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isMutable(), and view().
Referenced by clang::interp::CheckConst().
|
inline |
Checks if the index is one past end.
Definition at line 821 of file Pointer.h.
References BS, getOffset(), getSize(), isBlockPointer(), isPastEnd(), and isUnknownSizeArray().
Referenced by clang::interp::arePotentiallyOverlappingStringLiterals(), clang::interp::CheckRange(), clang::interp::CheckSubobject(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::computePointerOffset(), clang::interp::Free(), getByteOffset(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::isReadable(), clang::interp::OffsetHelper(), clang::interp::operator<<(), toAPValue(), and toRValue().
|
inline |
Checks if the pointer points past the end of the object.
Definition at line 835 of file Pointer.h.
References BS, isIntegralPointer(), and isZero().
Referenced by clang::interp::CheckExtern(), clang::interp::Context::evaluateStrlen(), isDereferencable(), isOnePastEnd(), and toRValue().
|
inline |
Pointer points directly to a block.
Definition at line 638 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::isRoot(), isZero(), and view().
Referenced by allElementsAlive(), clang::interp::ArrayDecay(), clang::interp::CheckActive(), clang::interp::EvaluationResult::checkDynamicAllocations(), clang::interp::CheckVolatile(), computeSplitPoint(), clang::interp::Free(), getFieldDesc(), isConst(), isConstInMutable(), isInitialized(), isVolatile(), clang::interp::pointsToLastObject(), and print().
|
inline |
Checks if the storage is static.
Definition at line 695 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by allElementsAlive(), clang::interp::CheckConstant(), CheckGlobal(), clang::interp::getDynamicDecl(), and isStaticTemporary().
|
inline |
Checks if the storage is a static temporary.
Definition at line 718 of file Pointer.h.
References isStatic(), and isTemporary().
|
inline |
Checks if the storage is temporary.
Definition at line 702 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by isStaticTemporary().
|
inline |
Definition at line 671 of file Pointer.h.
References clang::interp::Typeid.
Referenced by asTypeidPointer(), clang::interp::CheckBCPResult(), clang::interp::CmpHelper< Pointer >(), getByteOffset(), hasSameBase(), and toAPValue().
|
inline |
Checks if the structure is an array of unknown size.
Definition at line 625 of file Pointer.h.
References getFieldDesc(), isBlockPointer(), and clang::interp::Descriptor::isUnknownSizeArray().
Referenced by clang::interp::ArrayDecay(), clang::interp::CheckArray(), clang::interp::CheckArrayDestSize(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Context::evaluateStrlen(), clang::interp::GetField(), clang::interp::GetFieldPop(), clang::interp::interp__builtin_memcpy(), and isOnePastEnd().
|
inline |
Definition at line 748 of file Pointer.h.
References clang::interp::PtrView::isVirtualBaseClass(), and view().
Referenced by clang::interp::computePointerOffset().
|
inline |
Checks if an object or a subfield is volatile.
Definition at line 770 of file Pointer.h.
References getDeclDesc(), isBlockPointer(), isRoot(), and clang::interp::Descriptor::IsVolatile.
Referenced by clang::interp::CheckVolatile().
|
inline |
Definition at line 727 of file Pointer.h.
References BS, Fn, isBlockPointer(), and isFunctionPointer().
|
inline |
Checks if the pointer is null.
Definition at line 497 of file Pointer.h.
References clang::interp::Block, BS, Fn, clang::interp::Fn, Int, clang::interp::Int, and clang::interp::Typeid.
Referenced by clang::interp::ArrayDecay(), clang::interp::Call(), clang::interp::CallPtr(), clang::interp::CheckBCPResult(), clang::interp::CheckFinalLoad(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckLive(), clang::interp::CheckLoad(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckNonNullArgs(), clang::interp::CheckNull(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckStore(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Free(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_operator_delete(), clang::interp::isConstexprUnknown(), isPastEnd(), isRoot(), clang::interp::operator<<(), pointsToLabel(), pointsToLiteral(), pointsToStringLiteral(), clang::interp::MemberPointer::takeInstance(), toAPValue(), toDiagnosticString(), and toRValue().
|
inline |
Checks if the pointer is pointing to a zero-size array.
Definition at line 846 of file Pointer.h.
References getFieldDesc(), and isFunctionPointer().
Referenced by clang::interp::ArrayDecay(), clang::interp::CheckRange(), clang::interp::Free(), toAPValue(), and toRValue().
|
inlinenodiscard |
Restricts the scope of an array element pointer.
Definition at line 483 of file Pointer.h.
References isBlockPointer(), narrow(), Pointer(), and view().
Referenced by clang::interp::evaluateBuiltinObjectSize(), clang::interp::finishGlobalRecurse(), narrow(), clang::interp::NarrowPtr(), and clang::interp::RunDestructors().
Definition at line 95 of file Pointer.cpp.
References clang::interp::BlockPointer::Base, Block, clang::interp::Block, block(), BS, Fn, clang::interp::Fn, Int, clang::interp::Int, isBlockPointer(), Pointer(), Typeid, and clang::interp::Typeid.
Definition at line 134 of file Pointer.cpp.
References Block, clang::interp::Block, BS, Fn, clang::interp::Fn, Int, clang::interp::Int, isBlockPointer(), Pointer(), Typeid, and clang::interp::Typeid.
Equality operators are just for tests.
Definition at line 421 of file Pointer.h.
References Fn, clang::interp::FunctionPointer::Func, Int, isFunctionPointer(), isIntegralPointer(), Pointer(), clang::interp::IntPointer::Ty, clang::interp::IntPointer::Value, and view().
| bool Pointer::pointsToLabel | ( | ) | const |
Whether this points to a block created for an AddrLabelExpr.
Definition at line 747 of file Pointer.cpp.
References BS, clang::isa(), isBlockPointer(), and isZero().
Referenced by clang::interp::SubPtr().
| bool Pointer::pointsToLiteral | ( | ) | const |
Whether this points to a block that's been created for a "literal lvalue", i.e.
a non-MaterializeTemporaryExpr Expr.
Definition at line 725 of file Pointer.cpp.
References clang::interp::Descriptor::asExpr(), block(), clang::interp::Block::getDescriptor(), clang::isa(), isBlockPointer(), isDynamic(), and isZero().
| bool Pointer::pointsToStringLiteral | ( | ) | const |
Definition at line 736 of file Pointer.cpp.
References clang::interp::Descriptor::asExpr(), block(), clang::interp::Block::getDescriptor(), isBlockPointer(), isDynamic(), and isZero().
Referenced by clang::interp::arePotentiallyOverlappingStringLiterals(), and clang::interp::CmpHelperEQ< Pointer >().
Checks if both given pointers point to the same block.
Definition at line 714 of file Pointer.cpp.
References block(), isBlockPointer(), and Pointer().
Referenced by clang::interp::interp__builtin_memcpy(), and clang::interp::runRecordDestructor().
| void Pointer::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the pointer.
Definition at line 318 of file Pointer.cpp.
References asTypeidPointer(), Block, clang::interp::Block, BS, Fn, clang::interp::Fn, clang::interp::Block::getSize(), Int, clang::interp::Int, isElementPastEnd(), isRoot(), clang::interp::Typeid, clang::interp::TypeidPointer::TypeInfoType, and clang::interp::TypeidPointer::TypePtr.
Referenced by clang::interp::operator<<().
|
inline |
Definition at line 978 of file Pointer.h.
References isBlockPointer(), clang::interp::PtrView::setLifeState(), and view().
Referenced by endLifetime(), and startLifetime().
|
inline |
Start the lifetime of this pointer.
This works for pointer with an InlineDescriptor as well as primitive array elements. Pointers are usually alive by default, unless the underlying object has been allocated with std::allocator. This function is used by std::construct_at.
Definition at line 972 of file Pointer.h.
References setLifeState(), and clang::interp::Started.
Referenced by clang::interp::StartThisLifetime1().
|
inlinenodiscard |
Strip base casts from this Pointer.
The result is either a root pointer or something that isn't a base class anymore.
Definition at line 987 of file Pointer.h.
References Pointer(), V, and view().
Referenced by clang::interp::CallVirt(), clang::interp::evaluateBuiltinObjectSize(), clang::interp::Free(), clang::interp::getDynamicDecl(), clang::interp::interp__builtin_memcpy(), and clang::interp::VirtBaseHelper().
| APValue Pointer::toAPValue | ( | const ASTContext & | ASTCtx | ) | const |
Converts the pointer to an APValue.
Definition at line 173 of file Pointer.cpp.
References clang::APValue, clang::APValue::LValuePathEntry::ArrayIndex(), clang::interp::Descriptor::asDecl(), clang::interp::Descriptor::asExpr(), asFunctionPointer(), asIntPointer(), clang::interp::Descriptor::asValueDecl(), block(), clang::cast(), clang::interp::PtrView::expand(), clang::CharUnits::fromQuantity(), clang::interp::FunctionPointer::Func, clang::interp::PtrView::getArray(), clang::Type::getAsRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::interp::PtrView::getBase(), clang::ASTRecordLayout::getBaseClassOffset(), clang::interp::Descriptor::getDataType(), clang::interp::Function::getDecl(), clang::interp::Record::getDecl(), getDeclDesc(), getDeclPtr(), clang::RecordDecl::getDefinition(), clang::APValue::LValueBase::getDynamicAlloc(), clang::interp::Descriptor::getElemQualType(), clang::interp::Function::getExpr(), getFieldDesc(), clang::interp::PtrView::getFieldDesc(), clang::ASTRecordLayout::getFieldOffset(), getFieldOffset(), clang::interp::PtrView::getIndex(), clang::interp::PtrView::getNumElems(), clang::interp::PtrView::getRecord(), clang::APValue::LValueBase::getTypeInfo(), clang::ASTContext::getTypeSizeInChars(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::interp::Descriptor::IsArray, clang::interp::PtrView::isArrayElement(), clang::interp::PtrView::isArrayRoot(), isConstexprUnknown(), isDynamic(), clang::interp::PtrView::isField(), isFunctionPointer(), isIntegralPointer(), isOnePastEnd(), clang::interp::PtrView::isOnePastEnd(), isTypeidPointer(), clang::interp::PtrView::isVirtualBaseClass(), isZero(), isZeroSizeArray(), clang::Result, clang::ASTContext::toCharUnitsFromBits(), Typeid, view(), and clang::CharUnits::Zero().
Referenced by clang::interp::getDynamicDecl(), clang::interp::interp__builtin_assume_aligned(), toDiagnosticString(), and toRValue().
| std::string Pointer::toDiagnosticString | ( | const ASTContext & | Ctx | ) | const |
Converts the pointer to a string usable in diagnostics.
Definition at line 440 of file Pointer.cpp.
References asIntPointer(), clang::APValue::getAsString(), clang::Type::getPointeeType(), getType(), isIntegralPointer(), clang::Type::isLValueReferenceType(), isZero(), and toAPValue().
Referenced by clang::interp::CheckDeleteSource(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::diagnoseOutOfLifetimeDestroy(), clang::interp::Free(), clang::interp::getField(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_operator_delete(), and clang::interp::SubPtr().
Converts the pointer to an APValue that is an rvalue.
Definition at line 803 of file Pointer.cpp.
References clang::APValue, clang::interp::Descriptor::asFieldDecl(), clang::interp::PtrView::atField(), bool, clang::interp::Context::canClassify(), canDeref(), clang::interp::Context::classify(), deref(), clang::interp::PtrView::deref(), clang::interp::Record::fields(), std::function, clang::interp::Floating::getAPFloat(), clang::interp::Context::getASTContext(), clang::interp::Record::getBase(), clang::ASTContext::getCanonicalTagType(), clang::interp::Record::getField(), clang::interp::PtrView::getFieldDesc(), clang::interp::Record::getNumBases(), clang::interp::Record::getNumFields(), clang::interp::Record::getNumVirtualBases(), clang::interp::Descriptor::getPrimType(), clang::interp::Descriptor::getType(), clang::interp::Record::getVirtualBase(), INT_TYPE_SWITCH, clang::interp::PtrView::isActive(), clang::Type::isAnyComplexType(), isDummy(), clang::Type::isFunctionType(), clang::interp::isIntegerOrBoolType(), isIntegralPointer(), isLive(), clang::QualType::isNull(), isOnePastEnd(), isPastEnd(), clang::interp::Descriptor::isPrimitive(), isZero(), isZeroSizeArray(), Ok, clang::interp::PT_Float, clang::Result, toAPValue(), TYPE_SWITCH, and view().
|
inline |
Definition at line 450 of file Pointer.h.
References BS, and isBlockPointer().
Referenced by activate(), allElementsInitialized(), atField(), atIndex(), clang::interp::Call(), clang::interp::CheckConst(), clang::interp::EvaluationResult::checkDynamicAllocations(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckMutable(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckRange(), clang::interp::collectBlocks(), computeOffsetForComparison(), computeSplitPoint(), deref(), clang::interp::DoMemcpy(), elem(), elemSize(), enumeratePointerFields(), expand(), getArray(), getBase(), getElemRecord(), getIndex(), getNumElems(), getOffset(), getRecord(), getType(), inArray(), initialize(), initializeElement(), inPrimitiveArray(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), inUnion(), isActive(), isArrayElement(), isArrayRoot(), isBaseClass(), isDummy(), isElementInitialized(), isField(), isLive(), isMutable(), isRoot(), isVirtualBaseClass(), narrow(), operator==(), setLifeState(), clang::interp::SetThreeWayComparisonField(), clang::interp::StartInit(), stripBaseCasts(), toAPValue(), and toRValue().
|
friend |
Definition at line 1040 of file Pointer.h.
References Block.
Referenced by Block, block(), operator=(), operator=(), Pointer(), Pointer(), Pointer(), print(), and ~Pointer().
|
friend |
|
friend |
Definition at line 1044 of file Pointer.h.
References DynamicAllocator.
Referenced by DynamicAllocator.
|
friend |
|
friend |
|
friend |
| BlockPointer clang::interp::Pointer::BS |
Definition at line 1077 of file Pointer.h.
Referenced by allElementsAlive(), asBlockPointer(), atFieldSub(), block(), canBeInitialized(), clang::interp::DeadBlock::DeadBlock(), deref(), elem(), getDeclDesc(), getDeclID(), getDeclPtr(), getIntegerRepresentation(), getLifetime(), getRawAddress(), hasSameArray(), inUnion(), isDynamic(), isExtern(), isInitialized(), isOnePastEnd(), isPastEnd(), isStatic(), isTemporary(), isWeak(), isZero(), clang::interp::Block::movePointersTo(), operator=(), operator=(), Pointer(), Pointer(), Pointer(), pointsToLabel(), print(), Program, clang::interp::Block::removePointers(), view(), and ~Pointer().
| FunctionPointer clang::interp::Pointer::Fn |
Definition at line 1078 of file Pointer.h.
Referenced by asFunctionPointer(), atIndex(), getIntegerRepresentation(), getSource(), getType(), isWeak(), isZero(), operator=(), operator=(), operator==(), Pointer(), Pointer(), Pointer(), and print().
| IntPointer clang::interp::Pointer::Int |
Definition at line 1076 of file Pointer.h.
Referenced by asIntPointer(), atIndex(), computeOffsetForComparison(), getByteOffset(), getIntegerRepresentation(), getType(), isZero(), operator=(), operator=(), operator==(), Pointer(), Pointer(), Pointer(), Pointer(), Pointer(), and print().
| TypeidPointer clang::interp::Pointer::Typeid |
Definition at line 1079 of file Pointer.h.
Referenced by asTypeidPointer(), getByteOffset(), getType(), operator=(), operator=(), Pointer(), Pointer(), Pointer(), and toAPValue().