clang 20.0.0git
|
A pointer to a memory block, live or dead. More...
#include "/home/buildbot/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 Descriptor *Desc, uint64_t Offset=0) | |
Pointer (const Function *F, uint64_t Offset=0) | |
Pointer (Block *Pointee, unsigned Base, uint64_t Offset) | |
~Pointer () | |
void | operator= (const Pointer &P) |
void | 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 |
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. | |
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 |
bool | isBlockPointer () const |
bool | isIntegralPointer () const |
bool | isFunctionPointer () 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 | isUnion () const |
Checks if the object is a union. | |
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 | isInitialized () const |
Checks if an object was initialized. | |
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. | |
std::optional< unsigned > | 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 |
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. | |
template<typename T > | |
T & | deref () const |
Dereferences the pointer, if it's live. | |
bool | isDereferencable () const |
Whether this block can be read from at all. | |
void | initialize () const |
Initializes a field. | |
void | activate () const |
Activats a field. | |
void | deactivate () const |
Deactivates an entire strurcutre. | |
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. | |
void | print (llvm::raw_ostream &OS) const |
Prints the pointer. | |
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. | |
Friends | |
class | Block |
class | DeadBlock |
class | MemberPointer |
class | InterpState |
struct | InitMap |
class | DynamicAllocator |
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 89 of file Pointer.h.
References clang::interp::Int.
Referenced by atField(), atFieldSub(), atIndex(), expand(), getArray(), getBase(), getDeclPtr(), and narrow().
|
inline |
Pointer::Pointer | ( | Block * | B | ) |
Definition at line 25 of file Pointer.cpp.
Pointer::Pointer | ( | Block * | B, |
uint64_t | BaseAndOffset | ||
) |
Definition at line 29 of file Pointer.cpp.
Pointer::Pointer | ( | const Pointer & | P | ) |
Definition at line 32 of file Pointer.cpp.
References isBlockPointer().
Pointer::Pointer | ( | Pointer && | P | ) |
Definition at line 50 of file Pointer.cpp.
References clang::interp::Block, and P.
|
inline |
|
inline |
Definition at line 40 of file Pointer.cpp.
Pointer::~Pointer | ( | ) |
Definition at line 58 of file Pointer.cpp.
References isBlockPointer().
void Pointer::activate | ( | ) | const |
Activats a field.
Definition at line 404 of file Pointer.cpp.
References atField(), clang::interp::Record::fields(), getBase(), getFieldDesc(), getRecord(), inUnion(), clang::interp::InlineDescriptor::IsActive, isActive(), isRoot(), and clang::interp::Descriptor::isUnion().
Referenced by clang::interp::copyRecord(), clang::interp::FinishInit(), clang::interp::FinishInitPop(), and clang::interp::InitPop().
|
inline |
Definition at line 454 of file Pointer.h.
References isBlockPointer().
Referenced by atField(), atFieldSub(), atIndex(), block(), canBeInitialized(), deref(), elemSize(), expand(), getArray(), getBase(), getDeclDesc(), getDeclID(), getDeclPtr(), getIndex(), getIntegerRepresentation(), getOffset(), getType(), hasSameBase(), initialize(), isArrayElement(), isArrayRoot(), isDummy(), isDynamic(), isExtern(), isInitialized(), isLive(), isOnePastEnd(), isRoot(), isStatic(), isTemporary(), isWeak(), isZero(), narrow(), clang::interp::OffsetHelper(), and operator==().
|
inline |
Definition at line 462 of file Pointer.h.
References isFunctionPointer().
Referenced by atIndex(), getIntegerRepresentation(), getSource(), isZero(), clang::interp::OffsetHelper(), print(), and toAPValue().
|
inline |
Definition at line 458 of file Pointer.h.
References isIntegralPointer().
Referenced by atIndex(), elemSize(), getByteOffset(), getDeclDesc(), getFieldDesc(), getIntegerRepresentation(), clang::interp::GetPtrBase(), clang::interp::GetPtrBasePop(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), getSource(), isZero(), clang::interp::OffsetHelper(), operator==(), toAPValue(), and toDiagnosticString().
Creates a pointer to a field.
Definition at line 170 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), and Pointer().
Referenced by activate(), clang::interp::CheckFieldsInitialized(), clang::interp::collectBlocks(), clang::interp::copyRecord(), clang::interp::GetField(), clang::interp::GetFieldPop(), clang::interp::GetPtrActiveField(), clang::interp::GetPtrBase(), clang::interp::GetPtrBasePop(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), clang::interp::SetThreeWayComparisonField(), clang::interp::MemberPointer::toPointer(), and toRValue().
Subtract the given offset from the current Base and Offset of the pointer.
Definition at line 178 of file Pointer.h.
References asBlockPointer(), and Pointer().
Referenced by clang::interp::GetPtrDerivedPop().
|
inline |
Offsets a pointer inside an array.
Definition at line 151 of file Pointer.h.
References asBlockPointer(), asFunctionPointer(), asIntPointer(), elemSize(), getDeclDesc(), getFieldDesc(), getSize(), isFunctionPointer(), isIntegralPointer(), and Pointer().
Referenced by clang::interp::ArrayDecay(), clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), clang::interp::CheckArrayInitialized(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::collectBlocks(), clang::interp::CopyArray(), clang::interp::copyComposite(), clang::interp::Program::createGlobalString(), clang::interp::Divc(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::interp__builtin_elementwise_popcount(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::interp__builtin_vector_reduce(), clang::interp::Mulc(), clang::interp::OffsetHelper(), clang::interp::RunDestructors(), and toRValue().
|
inline |
Definition at line 586 of file Pointer.h.
References asBlockPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckConst(), clang::interp::CheckMutable(), CheckTemporary(), clang::interp::collectBlocks(), clang::interp::Free(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), clang::interp::interp__builtin_operator_delete(), isInitialized(), pointsToLiteral(), pointToSameBlock(), and clang::interp::MemberPointer::toPointer().
|
inline |
If this pointer has an InlineDescriptor we can use to initialize.
Definition at line 447 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, isBlockPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::FinishInit(), and clang::interp::FinishInitPop().
|
inline |
Compare two pointers.
Definition at line 676 of file Pointer.h.
References clang::Equal, clang::Greater, hasSameBase(), clang::Less, clang::Other, and clang::Unordered.
Referenced by clang::interp::CMP3().
void Pointer::deactivate | ( | ) | const |
Deactivates an entire strurcutre.
Definition at line 440 of file Pointer.cpp.
Referenced by clang::interp::GetPtrActiveField().
Dereferences the pointer, if it's live.
Definition at line 642 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, isArrayRoot(), isBlockPointer(), isDereferencable(), isLive(), clang::interp::BlockPointer::Pointee, clang::interp::Block::rawData(), and clang::T.
Referenced by clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), clang::interp::assignInteger(), clang::interp::collectBlocks(), clang::interp::CopyArray(), clang::interp::copyComposite(), clang::interp::copyRecord(), clang::interp::Divc(), clang::interp::GetGlobal(), clang::interp::GetGlobalUnchecked(), clang::interp::GetLocal(), clang::interp::InterpFrame::getParam(), clang::interp::IncDecFloatHelper(), clang::interp::IncDecHelper(), clang::interp::IncDecPtrHelper(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::InitGlobalTemp(), clang::interp::interp__builtin_elementwise_popcount(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::Load(), clang::interp::LoadPop(), clang::interp::Mulc(), clang::interp::InterpFrame::setParam(), clang::interp::SetThreeWayComparisonField(), and toRValue().
|
inline |
Returns the element size of the innermost field.
Definition at line 358 of file Pointer.h.
References asBlockPointer(), asIntPointer(), clang::interp::IntPointer::Desc, getDeclDesc(), clang::interp::Descriptor::getElemSize(), getFieldDesc(), clang::interp::Descriptor::getSize(), and isIntegralPointer().
Referenced by atIndex(), getIndex(), getIntegerRepresentation(), getNumElems(), clang::interp::interp__builtin_memcpy(), and clang::interp::OffsetHelper().
|
inline |
Expands a pointer to the containing array, undoing narrowing.
Definition at line 227 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, clang::interp::InlineDescriptor::Desc, getDeclDesc(), clang::interp::Block::getDescriptor(), clang::interp::Descriptor::getMetadataSize(), getSize(), inPrimitiveArray(), clang::interp::Descriptor::IsArray, isBlockPointer(), isElementPastEnd(), isRoot(), clang::interp::InlineDescriptor::Offset, clang::interp::BlockPointer::Pointee, and Pointer().
Referenced by clang::interp::AddOffset(), clang::interp::ExpandPtr(), and toAPValue().
|
inline |
Returns the parent array.
Definition at line 318 of file Pointer.h.
References asBlockPointer(), and Pointer().
Referenced by toAPValue().
|
inline |
Returns a pointer to the object of which this pointer is a field.
Definition at line 309 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, clang::interp::InlineDescriptor::Offset, and Pointer().
Referenced by activate(), clang::interp::CallVirt(), CheckActive(), clang::interp::CheckNewTypeMismatch(), clang::interp::Free(), and toAPValue().
|
inline |
Returns the byte offset from the start.
Definition at line 571 of file Pointer.h.
References asIntPointer(), isIntegralPointer(), isOnePastEnd(), and clang::interp::IntPointer::Value.
Referenced by clang::interp::CheckDowncast(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::DoMemcpy(), clang::interp::interp__builtin_is_aligned_up_down(), and clang::interp::OffsetHelper().
|
inline |
Accessor for information about the declaration site.
Definition at line 284 of file Pointer.h.
References asBlockPointer(), asIntPointer(), clang::interp::IntPointer::Desc, isBlockPointer(), isFunctionPointer(), isIntegralPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by atIndex(), clang::interp::CheckConstant(), clang::interp::CheckDowncast(), clang::interp::CheckDummy(), clang::interp::CheckExtern(), clang::interp::CheckFieldsInitialized(), clang::interp::CheckGlobalInitialized(), clang::interp::CheckInitialized(), CheckTemporary(), clang::interp::CheckWeak(), elemSize(), expand(), clang::interp::Free(), getDeclLoc(), getFieldDesc(), getSource(), clang::interp::InitGlobalTemp(), clang::interp::interp__builtin_assume_aligned(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_operator_delete(), isConst(), isDummy(), and toAPValue().
|
inline |
Returns the declaration ID.
Definition at line 562 of file Pointer.h.
References asBlockPointer(), clang::interp::Block::getDeclID(), isBlockPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by CheckGlobal(), and CheckTemporary().
|
inline |
Definition at line 294 of file Pointer.h.
References getDeclDesc(), and clang::interp::Descriptor::getLocation().
Referenced by clang::interp::CheckDeleteSource(), clang::interp::CheckLive(), and CheckTemporary().
|
inline |
Definition at line 353 of file Pointer.h.
References asBlockPointer(), and Pointer().
Referenced by clang::interp::CheckDowncast().
|
inline |
Returns the element record type, if this is a non-primive array.
Definition at line 474 of file Pointer.h.
References clang::interp::Descriptor::ElemDesc, clang::interp::Descriptor::ElemRecord, and getFieldDesc().
Referenced by clang::interp::CheckArrayInitialized().
|
inline |
Returns the field information.
Definition at line 479 of file Pointer.h.
References clang::interp::Descriptor::asFieldDecl(), and getFieldDesc().
Referenced by CheckActive(), clang::interp::CheckArrayInitialized(), and clang::interp::CheckMutable().
|
inline |
Accessors for information about the innermost field.
Definition at line 329 of file Pointer.h.
References asIntPointer(), clang::interp::InlineDescriptor::Desc, clang::interp::IntPointer::Desc, getDeclDesc(), isIntegralPointer(), and isRoot().
Referenced by activate(), clang::interp::ArrayElem(), clang::interp::ArrayElemPop(), atIndex(), clang::interp::checkConstructor(), clang::interp::CheckNewTypeMismatch(), clang::interp::collectBlocks(), clang::interp::copyComposite(), clang::interp::copyRecord(), elemSize(), getElemRecord(), getField(), clang::interp::GetGlobal(), getOffset(), getRecord(), getSize(), getType(), hasSameArray(), inArray(), initialize(), inPrimitiveArray(), clang::interp::interp__builtin_elementwise_popcount(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::interp__builtin_vector_reduce(), isField(), isInitialized(), isUnknownSizeArray(), isZeroSizeArray(), narrow(), toAPValue(), and toRValue().
|
inline |
Returns the index into an array.
Definition at line 589 of file Pointer.h.
References asBlockPointer(), elemSize(), getIntegerRepresentation(), getOffset(), isBlockPointer(), and isZero().
Referenced by initialize(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), isInitialized(), clang::interp::OffsetHelper(), clang::interp::SubPtr(), and toAPValue().
|
inline |
Definition at line 138 of file Pointer.h.
References asBlockPointer(), asFunctionPointer(), asIntPointer(), elemSize(), clang::interp::FunctionPointer::getIntegerRepresentation(), isFunctionPointer(), isIntegralPointer(), clang::interp::BlockPointer::Pointee, and clang::interp::IntPointer::Value.
Referenced by clang::interp::CastPointerIntegral(), clang::interp::CastPointerIntegralAP(), clang::interp::CastPointerIntegralAPS(), getIndex(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::OffsetHelper(), and clang::interp::SubPtr().
|
inline |
Returns the number of elements.
Definition at line 580 of file Pointer.h.
References elemSize(), getSize(), and isBlockPointer().
Referenced by clang::interp::interp__builtin_elementwise_popcount(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_vector_reduce(), clang::interp::OffsetHelper(), clang::interp::SubPtr(), and toAPValue().
|
inline |
Returns the offset into an array.
Definition at line 376 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, getFieldDesc(), and isBlockPointer().
Referenced by clang::interp::CmpHelperEQ< Pointer >(), getIndex(), and isOnePastEnd().
|
inline |
Returns the record descriptor of a class.
Definition at line 472 of file Pointer.h.
References clang::interp::Descriptor::ElemRecord, and getFieldDesc().
Referenced by activate(), clang::interp::CheckFieldsInitialized(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckNewTypeMismatch(), clang::interp::SetThreeWayComparisonField(), toAPValue(), and clang::interp::MemberPointer::toPointer().
|
inline |
Returns the total size of the innermost field.
Definition at line 370 of file Pointer.h.
References getFieldDesc(), clang::interp::Descriptor::getSize(), and isBlockPointer().
Referenced by atIndex(), expand(), getNumElems(), and isOnePastEnd().
|
inline |
Returns the expression or declaration the pointer has been created for.
Definition at line 297 of file Pointer.h.
References asFunctionPointer(), asIntPointer(), clang::interp::IntPointer::Desc, clang::interp::Function::getDecl(), getDeclDesc(), clang::interp::FunctionPointer::getFunction(), clang::interp::Descriptor::getSource(), isBlockPointer(), isFunctionPointer(), and isIntegralPointer().
Referenced by hasSameBase().
|
inline |
Returns the type of the innermost field.
Definition at line 339 of file Pointer.h.
References asBlockPointer(), getFieldDesc(), clang::interp::Descriptor::getType(), getType(), and inPrimitiveArray().
Referenced by clang::interp::CallVirt(), clang::interp::CheckConst(), clang::interp::CheckDowncast(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckNewTypeMismatch(), clang::interp::EvaluationResult::checkReturnValue(), clang::interp::CheckVolatile(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), clang::interp::Free(), getType(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::SetThreeWayComparisonField(), and toDiagnosticString().
Checks if two pointers can be subtracted.
Definition at line 469 of file Pointer.cpp.
References clang::interp::BlockPointer::Base, BS, getFieldDesc(), hasSameBase(), and clang::interp::Descriptor::IsArray.
Checks if two pointers are comparable.
Definition at line 444 of file Pointer.cpp.
References asBlockPointer(), getSource(), isFunctionPointer(), isIntegralPointer(), isZero(), and clang::interp::BlockPointer::Pointee.
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 399 of file Pointer.h.
References getFieldDesc(), clang::interp::Descriptor::IsArray, and isBlockPointer().
Referenced by isArrayElement(), isArrayRoot(), and clang::interp::OffsetHelper().
void Pointer::initialize | ( | ) | const |
Initializes a field.
Definition at line 356 of file Pointer.cpp.
References asBlockPointer(), getFieldDesc(), getIndex(), clang::interp::Descriptor::getNumElems(), clang::interp::Initialized, clang::interp::GlobalInlineDescriptor::InitState, isBlockPointer(), clang::interp::InlineDescriptor::IsInitialized, clang::interp::Descriptor::isPrimitiveArray(), isRoot(), isStatic(), clang::interp::BlockPointer::Pointee, and clang::interp::Block::rawData().
Referenced by clang::interp::CopyArray(), clang::interp::copyComposite(), clang::interp::copyRecord(), enumerateData(), clang::interp::FinishInit(), clang::interp::FinishInitPop(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::InitGlobalTemp(), clang::interp::interp__builtin_carryop(), clang::interp::interp__builtin_elementwise_popcount(), clang::interp::interp__builtin_overflowop(), clang::interp::SetThreeWayComparisonField(), clang::interp::Store(), clang::interp::StoreBitField(), clang::interp::StoreBitFieldPop(), and clang::interp::StorePop().
|
inline |
Checks if the structure is a primitive array.
Definition at line 411 of file Pointer.h.
References getFieldDesc(), isBlockPointer(), and clang::interp::Descriptor::isPrimitiveArray().
|
inline |
Definition at line 404 of file Pointer.h.
References clang::interp::InlineDescriptor::InUnion, and isBlockPointer().
Referenced by activate(), CheckActive(), and clang::interp::CheckNewTypeMismatch().
|
inline |
Checks if the object is active.
Definition at line 533 of file Pointer.h.
References clang::interp::InlineDescriptor::IsActive, isBlockPointer(), and isRoot().
Referenced by activate(), CheckActive(), clang::interp::CheckFieldsInitialized(), clang::interp::CheckNewTypeMismatch(), clang::interp::copyRecord(), and toRValue().
|
inline |
Checks if the pointer points to an array.
Definition at line 423 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, inArray(), and isBlockPointer().
Referenced by clang::interp::Free(), and toAPValue().
|
inline |
Whether this array refers to an array, but not to the first element.
Definition at line 394 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, and inArray().
Referenced by clang::interp::CmpHelperEQ< Pointer >(), deref(), and toAPValue().
|
inline |
Checks if a structure is a base class.
Definition at line 539 of file Pointer.h.
References clang::interp::InlineDescriptor::IsBase, and isField().
Referenced by clang::interp::CallVirt(), and clang::interp::Free().
|
inline |
Definition at line 467 of file Pointer.h.
References clang::interp::Block.
Referenced by asBlockPointer(), atField(), canBeInitialized(), clang::interp::CheckConst(), clang::interp::CheckConstant(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckVolatile(), deref(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), clang::interp::DoMemcpy(), expand(), getDeclDesc(), getDeclID(), getIndex(), getNumElems(), getOffset(), clang::interp::GetPtrBase(), clang::interp::GetPtrBasePop(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), getSize(), getSource(), inArray(), initialize(), inPrimitiveArray(), clang::interp::interp__builtin_assume_aligned(), inUnion(), isActive(), isArrayElement(), isDereferencable(), isDummy(), isDynamic(), isExtern(), isField(), isInitialized(), isLive(), isMutable(), isStatic(), isTemporary(), isUnknownSizeArray(), isWeak(), isZero(), clang::interp::Load(), clang::interp::LoadPop(), narrow(), clang::interp::OffsetHelper(), operator=(), operator==(), Pointer(), pointsToLiteral(), pointToSameBlock(), clang::interp::SubPtr(), and ~Pointer().
|
inline |
Checks if an object or a subfield is mutable.
Definition at line 555 of file Pointer.h.
References getDeclDesc(), clang::interp::InlineDescriptor::IsConst, clang::interp::Descriptor::IsConst, isIntegralPointer(), 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 659 of file Pointer.h.
References isBlockPointer(), and isPastEnd().
Referenced by deref().
|
inline |
Checks if the pointer points to a dummy value.
Definition at line 544 of file Pointer.h.
References asBlockPointer(), getDeclDesc(), isBlockPointer(), and clang::interp::Descriptor::isDummy().
Referenced by clang::interp::CheckDummy(), clang::interp::CheckInvoke(), clang::interp::CheckPointerToIntegralCast(), clang::interp::IncDecHelper(), clang::interp::IncDecPtrHelper(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_overflowop(), clang::interp::interp__builtin_strcmp(), and toRValue().
|
inline |
Checks if the storage has been dynamically allocated.
Definition at line 506 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isDynamic(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckLive(), and pointsToLiteral().
|
inline |
Checks if the pointer is an out-of-bounds element pointer.
Definition at line 630 of file Pointer.h.
Referenced by clang::interp::CheckRange(), expand(), isOnePastEnd(), print(), and clang::interp::SubPtr().
|
inline |
Checks if the storage is extern.
Definition at line 485 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isExtern(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckExtern(), and clang::interp::GetGlobal().
|
inline |
Checks if the item is a field in an object.
Definition at line 276 of file Pointer.h.
References clang::interp::Descriptor::asDecl(), getFieldDesc(), isBlockPointer(), and isRoot().
Referenced by CheckActive(), clang::interp::CheckLive(), isBaseClass(), isVirtualBaseClass(), and toAPValue().
|
inline |
Definition at line 469 of file Pointer.h.
References clang::interp::Fn.
Referenced by asFunctionPointer(), atIndex(), getDeclDesc(), getIntegerRepresentation(), getSource(), hasSameBase(), isOnePastEnd(), isZero(), isZeroSizeArray(), clang::interp::OffsetHelper(), and toAPValue().
bool Pointer::isInitialized | ( | ) | const |
Checks if an object was initialized.
Definition at line 320 of file Pointer.cpp.
References asBlockPointer(), block(), getFieldDesc(), getIndex(), clang::interp::Initialized, clang::interp::GlobalInlineDescriptor::InitState, isBlockPointer(), clang::interp::InlineDescriptor::IsInitialized, clang::interp::Descriptor::isPrimitiveArray(), isRoot(), isStatic(), and clang::interp::Block::rawData().
Referenced by clang::interp::CheckArrayInitialized(), clang::interp::CheckExtern(), clang::interp::CheckFieldsInitialized(), clang::interp::CheckGlobalInitialized(), clang::interp::CheckInitialized(), clang::interp::copyRecord(), clang::interp::Program::dump(), and clang::interp::GetGlobalUnchecked().
|
inline |
Definition at line 468 of file Pointer.h.
References clang::interp::Int.
Referenced by asIntPointer(), atIndex(), elemSize(), getByteOffset(), getDeclDesc(), getFieldDesc(), getIntegerRepresentation(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), getSource(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), isConst(), isOnePastEnd(), isPastEnd(), isRoot(), isZero(), clang::interp::OffsetHelper(), operator==(), toAPValue(), toDiagnosticString(), and toRValue().
|
inline |
Checks if the pointer is live.
Definition at line 270 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckConst(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckInitialized(), clang::interp::CheckLive(), clang::interp::CheckMutable(), clang::interp::CheckVolatile(), clang::interp::copyComposite(), deref(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), and toRValue().
|
inline |
Checks if the field is mutable.
Definition at line 517 of file Pointer.h.
References isBlockPointer(), clang::interp::InlineDescriptor::IsFieldMutable, and isRoot().
Referenced by clang::interp::CheckConst(), and clang::interp::CheckMutable().
|
inline |
Checks if the index is one past end.
Definition at line 607 of file Pointer.h.
References asBlockPointer(), getOffset(), getSize(), isElementPastEnd(), isFunctionPointer(), isIntegralPointer(), isPastEnd(), isUnknownSizeArray(), and isZeroSizeArray().
Referenced by clang::interp::CheckRange(), clang::interp::CheckSubobject(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Free(), getByteOffset(), narrow(), clang::interp::OffsetHelper(), and toAPValue().
|
inline |
Checks if the pointer points past the end of the object.
Definition at line 622 of file Pointer.h.
References isIntegralPointer(), and isZero().
Referenced by isDereferencable(), isOnePastEnd(), and toRValue().
|
inline |
Pointer points directly to a block.
Definition at line 439 of file Pointer.h.
References asBlockPointer(), isIntegralPointer(), and isZero().
Referenced by activate(), clang::interp::ArrayDecay(), clang::interp::EvaluationResult::checkReturnValue(), expand(), clang::interp::Free(), getFieldDesc(), initialize(), isActive(), isConst(), isField(), isInitialized(), isMutable(), and print().
|
inline |
Checks if the storage is static.
Definition at line 491 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isStatic(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckConstant(), CheckGlobal(), initialize(), isInitialized(), and isStaticTemporary().
|
inline |
Checks if the storage is a static temporary.
Definition at line 514 of file Pointer.h.
References isStatic(), and isTemporary().
Referenced by CheckTemporary().
|
inline |
Checks if the storage is temporary.
Definition at line 498 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isTemporary(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckDeleteSource(), clang::interp::CheckLive(), and isStaticTemporary().
bool clang::interp::Pointer::isUnion | ( | ) | const |
Checks if the object is a union.
|
inline |
Checks if the structure is an array of unknown size.
Definition at line 417 of file Pointer.h.
References getFieldDesc(), isBlockPointer(), and clang::interp::Descriptor::isUnknownSizeArray().
Referenced by clang::interp::ArrayDecay(), clang::interp::CheckArray(), isOnePastEnd(), narrow(), and toAPValue().
|
inline |
Definition at line 540 of file Pointer.h.
References isField(), and clang::interp::InlineDescriptor::IsVirtualBase.
Referenced by toAPValue().
|
inline |
Definition at line 523 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isWeak(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckWeak().
|
inline |
Checks if the pointer is null.
Definition at line 261 of file Pointer.h.
References asBlockPointer(), asFunctionPointer(), asIntPointer(), isBlockPointer(), isFunctionPointer(), isIntegralPointer(), clang::interp::FunctionPointer::isZero(), clang::interp::BlockPointer::Pointee, and clang::interp::IntPointer::Value.
Referenced by clang::interp::ArrayDecay(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::CheckLive(), clang::interp::CheckNonNullArgs(), clang::interp::CheckNull(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Free(), getIndex(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_operator_delete(), isPastEnd(), isRoot(), narrow(), pointsToLiteral(), clang::interp::PtrPtrCast(), clang::interp::SubPtr(), clang::interp::MemberPointer::takeInstance(), toAPValue(), toDiagnosticString(), and toRValue().
|
inline |
Checks if the pointer is pointing to a zero-size array.
Definition at line 633 of file Pointer.h.
References getFieldDesc(), and isFunctionPointer().
Referenced by isOnePastEnd().
|
inline |
Restricts the scope of an array element pointer.
Definition at line 185 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, getFieldDesc(), inPrimitiveArray(), isBlockPointer(), isOnePastEnd(), isUnknownSizeArray(), isZero(), and Pointer().
Referenced by clang::interp::CheckArrayInitialized(), clang::interp::collectBlocks(), clang::interp::Program::createGlobalString(), clang::interp::NarrowPtr(), clang::interp::RunDestructors(), and toRValue().
void Pointer::operator= | ( | const Pointer & | P | ) |
Definition at line 69 of file Pointer.cpp.
References isBlockPointer(), and P.
void Pointer::operator= | ( | Pointer && | P | ) |
Definition at line 104 of file Pointer.cpp.
References isBlockPointer(), and P.
Equality operators are just for tests.
Definition at line 117 of file Pointer.h.
References asBlockPointer(), asIntPointer(), clang::interp::BlockPointer::Base, isBlockPointer(), isIntegralPointer(), P, clang::interp::BlockPointer::Pointee, and clang::interp::IntPointer::Value.
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 475 of file Pointer.cpp.
References clang::interp::Descriptor::asExpr(), block(), E, clang::interp::Block::getDescriptor(), isBlockPointer(), isDynamic(), and isZero().
Checks if both given pointers point to the same block.
Definition at line 463 of file Pointer.cpp.
References block(), and isBlockPointer().
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 276 of file Pointer.cpp.
References asFunctionPointer(), clang::interp::Block, clang::interp::Fn, clang::interp::FunctionPointer::getFunction(), clang::interp::Block::getSize(), clang::interp::Int, isElementPastEnd(), and isRoot().
APValue Pointer::toAPValue | ( | const ASTContext & | ASTCtx | ) | const |
Converts the pointer to an APValue.
Definition at line 140 of file Pointer.cpp.
References clang::APValue::LValuePathEntry::ArrayIndex(), clang::interp::Descriptor::asDecl(), clang::interp::Descriptor::asExpr(), asFunctionPointer(), asIntPointer(), clang::interp::Descriptor::asValueDecl(), E, expand(), clang::CharUnits::fromQuantity(), getArray(), clang::ASTContext::getASTRecordLayout(), getBase(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTContext::getConstantArrayType(), clang::interp::Record::getDecl(), getDeclDesc(), clang::APValue::LValueBase::getDynamicAlloc(), clang::interp::Descriptor::getElemQualType(), getFieldDesc(), getFieldOffset(), clang::ASTRecordLayout::getFieldOffset(), getIndex(), clang::interp::Descriptor::getNumElems(), getNumElems(), getRecord(), clang::ASTContext::getTypeSizeInChars(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::interp::Descriptor::isArray(), isArrayElement(), isArrayRoot(), isField(), isFunctionPointer(), isIntegralPointer(), isOnePastEnd(), isUnknownSizeArray(), isVirtualBaseClass(), isZero(), clang::Normal, Path, clang::interp::FunctionPointer::toAPValue(), clang::ASTContext::toCharUnitsFromBits(), and clang::CharUnits::Zero().
Referenced by 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 310 of file Pointer.cpp.
References asIntPointer(), clang::APValue::getAsString(), getType(), isIntegralPointer(), isZero(), and toAPValue().
Referenced by clang::interp::CheckDeleteSource(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Free(), and clang::interp::interp__builtin_memcpy().
Converts the pointer to an APValue that is an rvalue.
Definition at line 486 of file Pointer.cpp.
References clang::interp::Descriptor::asFieldDecl(), atField(), atIndex(), bool, clang::interp::Context::classify(), deref(), clang::interp::Record::fields(), clang::interp::Floating::getAPFloat(), clang::APValue::getArrayInitializedElt(), clang::interp::Context::getASTContext(), clang::interp::Record::getBase(), clang::interp::Record::getField(), getFieldDesc(), clang::interp::Record::getNumBases(), clang::interp::Record::getNumFields(), clang::interp::Record::getNumVirtualBases(), clang::ASTContext::getRecordType(), clang::interp::Record::getVirtualBase(), INT_TYPE_SWITCH, isActive(), isDummy(), clang::Type::isFloatingType(), clang::Type::isIntegerType(), isIntegralPointer(), isLive(), clang::QualType::isNull(), isPastEnd(), isZero(), narrow(), Ok, clang::Result, clang::T, toAPValue(), and TYPE_SWITCH.
|
friend |
|
friend |
|
friend |
BlockPointer clang::interp::Pointer::BS |
Definition at line 746 of file Pointer.h.
Referenced by clang::interp::DynamicAllocator::cleanup(), and hasSameArray().
FunctionPointer clang::interp::Pointer::Fn |
IntPointer clang::interp::Pointer::Int |