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/Interp/Pointer.h"
Public Member Functions | |
Pointer () | |
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 () | |
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 | 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 | 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. | |
unsigned | 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. | |
template<typename T > | |
T & | elem (unsigned I) const |
Dereferences a primitive element. | |
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. | |
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. | |
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 86 of file Pointer.h.
References clang::interp::Int.
Referenced by atField(), atFieldSub(), atIndex(), expand(), getArray(), getBase(), getDeclPtr(), and narrow().
Pointer::Pointer | ( | Block * | B | ) |
Definition at line 24 of file Pointer.cpp.
Pointer::Pointer | ( | Block * | B, |
uint64_t | BaseAndOffset | ||
) |
Definition at line 28 of file Pointer.cpp.
Pointer::Pointer | ( | const Pointer & | P | ) |
Definition at line 31 of file Pointer.cpp.
References isBlockPointer().
Pointer::Pointer | ( | Pointer && | P | ) |
Definition at line 49 of file Pointer.cpp.
References clang::interp::Block, and P.
|
inline |
|
inline |
Pointer::~Pointer | ( | ) |
Definition at line 57 of file Pointer.cpp.
References isBlockPointer().
void Pointer::activate | ( | ) | const |
Activats a field.
Definition at line 355 of file Pointer.cpp.
References clang::interp::InlineDescriptor::IsActive, and isRoot().
Referenced by clang::interp::FinishInit(), and clang::interp::FinishInitPop().
|
inline |
Definition at line 433 of file Pointer.h.
References isBlockPointer().
Referenced by atField(), atFieldSub(), atIndex(), block(), canBeInitialized(), deref(), elem(), elemSize(), expand(), getArray(), getBase(), getDeclDesc(), getDeclID(), getDeclPtr(), getIndex(), getIntegerRepresentation(), getOffset(), getType(), hasSameBase(), initialize(), isArrayElement(), isArrayRoot(), isDummy(), isExtern(), isInitialized(), isLive(), isOnePastEnd(), isRoot(), isStatic(), isTemporary(), isZero(), narrow(), clang::interp::OffsetHelper(), and operator==().
|
inline |
Definition at line 441 of file Pointer.h.
References isFunctionPointer().
Referenced by atIndex(), getIntegerRepresentation(), getSource(), isZero(), and toAPValue().
|
inline |
Definition at line 437 of file Pointer.h.
References isIntegralPointer().
Referenced by atField(), atIndex(), elemSize(), getByteOffset(), getDeclDesc(), getFieldDesc(), getIntegerRepresentation(), getSource(), isZero(), operator==(), toAPValue(), and toDiagnosticString().
Creates a pointer to a field.
Definition at line 163 of file Pointer.h.
References asBlockPointer(), asIntPointer(), isIntegralPointer(), and Pointer().
Referenced by clang::interp::CheckFieldsInitialized(), clang::interp::collectBlocks(), clang::interp::DoMemcpy(), clang::interp::GetField(), clang::interp::GetFieldPop(), clang::interp::GetPtrActiveField(), clang::interp::GetPtrBase(), clang::interp::GetPtrBasePop(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), clang::interp::runRecordDestructor(), 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 172 of file Pointer.h.
References asBlockPointer(), and Pointer().
Referenced by clang::interp::GetPtrDerivedPop().
|
inline |
Offsets a pointer inside an array.
Definition at line 144 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::Program::createGlobalString(), clang::interp::Divc(), clang::interp::DoMemcpy(), 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::Mulc(), clang::interp::OffsetHelper(), clang::interp::RunDestructors(), clang::interp::runRecordDestructor(), and toRValue().
|
inline |
Definition at line 559 of file Pointer.h.
References asBlockPointer(), and clang::interp::BlockPointer::Pointee.
Referenced by clang::interp::CheckConst(), clang::interp::CheckMutable(), clang::interp::collectBlocks(), clang::interp::Free(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), isInitialized(), and clang::interp::MemberPointer::toPointer().
|
inline |
If this pointer has an InlineDescriptor we can use to initialize.
Definition at line 426 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 652 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 366 of file Pointer.cpp.
Referenced by clang::interp::GetPtrActiveField().
Dereferences the pointer, if it's live.
Definition at line 609 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::Divc(), clang::interp::DoMemcpy(), clang::interp::GetGlobal(), clang::interp::GetGlobalUnchecked(), clang::interp::GetLocal(), clang::interp::InterpFrame::getParam(), clang::interp::IncDecFloatHelper(), clang::interp::IncDecHelper(), clang::interp::IncDecPtrHelper(), clang::interp::InitGlobalTemp(), 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().
Dereferences a primitive element.
Definition at line 625 of file Pointer.h.
References asBlockPointer(), clang::interp::Block::data(), getNumElems(), isBlockPointer(), clang::interp::BlockPointer::Pointee, and clang::T.
|
inline |
Returns the element size of the innermost field.
Definition at line 353 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(), and getNumElems().
|
inline |
Expands a pointer to the containing array, undoing narrowing.
Definition at line 221 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::ExpandPtr().
|
inline |
Returns the parent array.
Definition at line 313 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 304 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, clang::interp::InlineDescriptor::Offset, and Pointer().
Referenced by CheckActive(), and toAPValue().
|
inline |
Returns the byte offset from the start.
Definition at line 544 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 >(), and clang::interp::interp__builtin_is_aligned_up_down().
|
inline |
Accessor for information about the declaration site.
Definition at line 279 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(), elemSize(), expand(), clang::interp::Free(), getDeclLoc(), getFieldDesc(), getSource(), clang::interp::InitGlobalTemp(), clang::interp::interp__builtin_is_aligned_up_down(), isConst(), isDummy(), isWeak(), and toAPValue().
|
inline |
Returns the declaration ID.
Definition at line 535 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 289 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 348 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 453 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 458 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 324 of file Pointer.h.
References asIntPointer(), clang::interp::InlineDescriptor::Desc, clang::interp::IntPointer::Desc, getDeclDesc(), isIntegralPointer(), and isRoot().
Referenced by atIndex(), clang::interp::collectBlocks(), clang::interp::DoMemcpy(), elemSize(), getElemRecord(), getField(), clang::interp::GetGlobal(), getOffset(), getRecord(), getSize(), getType(), hasSameArray(), inArray(), initialize(), inPrimitiveArray(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), isField(), isInitialized(), isUnknownSizeArray(), isZeroSizeArray(), narrow(), toAPValue(), and toRValue().
|
inline |
Returns the index into an array.
Definition at line 562 of file Pointer.h.
References asBlockPointer(), elemSize(), getOffset(), isBlockPointer(), and isZero().
Referenced by initialize(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), isInitialized(), clang::interp::OffsetHelper(), clang::interp::SubPtr(), and toAPValue().
|
inline |
Definition at line 131 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(), and clang::interp::interp__builtin_atomic_lock_free().
|
inline |
Returns the number of elements.
Definition at line 553 of file Pointer.h.
References elemSize(), getSize(), and isBlockPointer().
Referenced by elem(), clang::interp::interp__builtin_nan(), clang::interp::OffsetHelper(), clang::interp::SubPtr(), and toAPValue().
|
inline |
Returns the offset into an array.
Definition at line 371 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 451 of file Pointer.h.
References clang::interp::Descriptor::ElemRecord, and getFieldDesc().
Referenced by clang::interp::CheckFieldsInitialized(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::SetThreeWayComparisonField(), toAPValue(), and clang::interp::MemberPointer::toPointer().
|
inline |
Returns the total size of the innermost field.
Definition at line 365 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 292 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 334 of file Pointer.h.
References asBlockPointer(), getFieldDesc(), clang::interp::Descriptor::getType(), getType(), and inPrimitiveArray().
Referenced by clang::interp::CheckConst(), clang::interp::CheckDowncast(), clang::interp::EvaluationResult::checkFullyInitialized(), clang::interp::EvaluationResult::checkReturnValue(), clang::interp::CheckVolatile(), getType(), clang::interp::SetThreeWayComparisonField(), toAPValue(), toDiagnosticString(), and toRValue().
Checks if two pointers can be subtracted.
Definition at line 389 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 370 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 394 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 307 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::DoMemcpy(), clang::interp::FinishInit(), clang::interp::FinishInitPop(), clang::interp::InitGlobalTemp(), clang::interp::InitPop(), clang::interp::interp__builtin_carryop(), 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 400 of file Pointer.h.
References getFieldDesc(), isBlockPointer(), and clang::interp::Descriptor::isPrimitiveArray().
|
inline |
Checks if the object is active.
Definition at line 506 of file Pointer.h.
References clang::interp::InlineDescriptor::IsActive, isBlockPointer(), and isRoot().
Referenced by CheckActive(), clang::interp::CheckFieldsInitialized(), and toRValue().
|
inline |
Checks if the pointer points to an array.
Definition at line 412 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 389 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 512 of file Pointer.h.
References clang::interp::InlineDescriptor::IsBase, and isField().
|
inline |
Definition at line 446 of file Pointer.h.
References clang::interp::Block.
Referenced by asBlockPointer(), canBeInitialized(), clang::interp::CheckConst(), clang::interp::CheckConstant(), clang::interp::CheckVolatile(), deref(), elem(), expand(), getDeclDesc(), getDeclID(), getIndex(), getNumElems(), getOffset(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), getSize(), getSource(), inArray(), initialize(), inPrimitiveArray(), isActive(), isArrayElement(), isDereferencable(), isDummy(), isExtern(), isField(), isInitialized(), isLive(), isMutable(), isStatic(), isTemporary(), isUnknownSizeArray(), isWeak(), isZero(), clang::interp::Load(), clang::interp::LoadPop(), narrow(), clang::interp::OffsetHelper(), operator=(), operator==(), Pointer(), print(), and ~Pointer().
|
inline |
Checks if an object or a subfield is mutable.
Definition at line 528 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 635 of file Pointer.h.
References isBlockPointer(), and isPastEnd().
Referenced by deref().
|
inline |
Checks if the pointer points to a dummy value.
Definition at line 517 of file Pointer.h.
References asBlockPointer(), getDeclDesc(), isBlockPointer(), and clang::interp::Descriptor::isDummy().
Referenced by clang::interp::ArrayDecay(), clang::interp::CastPointerIntegral(), clang::interp::CastPointerIntegralAP(), clang::interp::CastPointerIntegralAPS(), clang::interp::CheckDummy(), clang::interp::CheckInvoke(), clang::interp::IncDecHelper(), clang::interp::IncDecPtrHelper(), clang::interp::interp__builtin_overflowop(), clang::interp::interp__builtin_strcmp(), toAPValue(), and toRValue().
|
inline |
Checks if the pointer is an out-of-bounds element pointer.
Definition at line 603 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 464 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 271 of file Pointer.h.
References clang::interp::Descriptor::asDecl(), getFieldDesc(), isBlockPointer(), and isRoot().
Referenced by clang::interp::CheckLive(), isBaseClass(), isVirtualBaseClass(), and toAPValue().
|
inline |
Definition at line 448 of file Pointer.h.
References clang::interp::Fn.
Referenced by asFunctionPointer(), atIndex(), getDeclDesc(), getIntegerRepresentation(), getSource(), hasSameBase(), isOnePastEnd(), isZero(), and toAPValue().
bool Pointer::isInitialized | ( | ) | const |
Checks if an object was initialized.
Definition at line 271 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::Program::dump(), and clang::interp::GetGlobalUnchecked().
|
inline |
Definition at line 447 of file Pointer.h.
References clang::interp::Int.
Referenced by asIntPointer(), atField(), atIndex(), elemSize(), getByteOffset(), getDeclDesc(), getFieldDesc(), getIntegerRepresentation(), getSource(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), isConst(), isOnePastEnd(), isPastEnd(), isRoot(), isZero(), operator==(), toAPValue(), toDiagnosticString(), and toRValue().
|
inline |
Checks if the pointer is live.
Definition at line 265 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(), deref(), clang::interp::DoMemcpy(), and toRValue().
|
inline |
Checks if the field is mutable.
Definition at line 488 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 580 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 595 of file Pointer.h.
References isIntegralPointer(), and isZero().
Referenced by isDereferencable(), isOnePastEnd(), and toRValue().
|
inline |
Pointer points directly to a block.
Definition at line 418 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 470 of file Pointer.h.
References asBlockPointer(), isBlockPointer(), clang::interp::Block::isStatic(), and clang::interp::BlockPointer::Pointee.
Referenced by CheckGlobal(), initialize(), isInitialized(), and isStaticTemporary().
|
inline |
Checks if the storage is a static temporary.
Definition at line 485 of file Pointer.h.
References isStatic(), and isTemporary().
Referenced by CheckTemporary().
|
inline |
Checks if the storage is temporary.
Definition at line 477 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 406 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 513 of file Pointer.h.
References isField(), and clang::interp::InlineDescriptor::IsVirtualBase.
Referenced by toAPValue().
|
inline |
Definition at line 494 of file Pointer.h.
References getDeclDesc(), and isBlockPointer().
|
inline |
Checks if the pointer is null.
Definition at line 256 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::CmpHelperEQ< Pointer >(), clang::interp::Free(), getIndex(), hasSameBase(), clang::interp::interp__builtin_atomic_lock_free(), isPastEnd(), isRoot(), narrow(), 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 606 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::isZeroSizeArray().
Referenced by isOnePastEnd().
|
inline |
Restricts the scope of an array element pointer.
Definition at line 179 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(), clang::interp::runRecordDestructor(), and toRValue().
void Pointer::operator= | ( | const Pointer & | P | ) |
Definition at line 67 of file Pointer.cpp.
References clang::interp::Block, isBlockPointer(), and P.
void Pointer::operator= | ( | Pointer && | P | ) |
Definition at line 97 of file Pointer.cpp.
References clang::interp::Block, isBlockPointer(), and P.
Equality operators are just for tests.
Definition at line 110 of file Pointer.h.
References asBlockPointer(), asIntPointer(), clang::interp::BlockPointer::Base, isBlockPointer(), isIntegralPointer(), P, clang::interp::BlockPointer::Pointee, and clang::interp::IntPointer::Value.
void Pointer::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the pointer.
Definition at line 234 of file Pointer.cpp.
References clang::interp::Block::getSize(), isBlockPointer(), isElementPastEnd(), and isRoot().
APValue Pointer::toAPValue | ( | const ASTContext & | ASTCtx | ) | const |
Converts the pointer to an APValue.
Definition at line 127 of file Pointer.cpp.
References clang::APValue::LValuePathEntry::ArrayIndex(), clang::interp::Descriptor::asDecl(), clang::interp::Descriptor::asExpr(), asFunctionPointer(), asIntPointer(), clang::interp::Descriptor::asValueDecl(), E, clang::CharUnits::fromQuantity(), getArray(), clang::ASTContext::getASTRecordLayout(), getBase(), clang::ASTRecordLayout::getBaseClassOffset(), clang::interp::Record::getDecl(), getDeclDesc(), getFieldDesc(), getFieldOffset(), clang::ASTRecordLayout::getFieldOffset(), getIndex(), getNumElems(), getRecord(), getType(), clang::ASTContext::getTypeSizeInChars(), clang::ASTRecordLayout::getVBaseClassOffset(), isArrayElement(), isArrayRoot(), isDummy(), isField(), isFunctionPointer(), isIntegralPointer(), isOnePastEnd(), isUnknownSizeArray(), isVirtualBaseClass(), isZero(), Path, clang::interp::FunctionPointer::toAPValue(), clang::ASTContext::toCharUnitsFromBits(), and clang::CharUnits::Zero().
Referenced by toDiagnosticString(), and toRValue().
std::string Pointer::toDiagnosticString | ( | const ASTContext & | Ctx | ) | const |
Converts the pointer to a string usable in diagnostics.
Definition at line 261 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 >(), and clang::interp::Free().
Converts the pointer to an APValue that is an rvalue.
Definition at line 395 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(), getType(), clang::interp::Record::getVirtualBase(), INT_TYPE_SWITCH, isActive(), isDummy(), clang::Type::isFloatingType(), clang::Type::isIntegerType(), isIntegralPointer(), isLive(), clang::QualType::isNull(), isPastEnd(), isZero(), narrow(), clang::Result, clang::T, toAPValue(), and TYPE_SWITCH.
|
friend |
|
friend |
|
friend |
BlockPointer clang::interp::Pointer::BS |
Definition at line 716 of file Pointer.h.
Referenced by clang::interp::DynamicAllocator::cleanup(), and hasSameArray().
FunctionPointer clang::interp::Pointer::Fn |
IntPointer clang::interp::Pointer::Int |