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 () | |
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 | 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. | |
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 88 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 |
Pointer::~Pointer | ( | ) |
Definition at line 58 of file Pointer.cpp.
References isBlockPointer().
void Pointer::activate | ( | ) | const |
Activats a field.
Definition at line 395 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(), and clang::interp::FinishInitPop().
|
inline |
Definition at line 443 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 451 of file Pointer.h.
References isFunctionPointer().
Referenced by atIndex(), getIntegerRepresentation(), getSource(), isZero(), print(), and toAPValue().
|
inline |
Definition at line 447 of file Pointer.h.
References isIntegralPointer().
Referenced by atIndex(), elemSize(), getByteOffset(), getDeclDesc(), getFieldDesc(), getIntegerRepresentation(), clang::interp::GetPtrField(), clang::interp::GetPtrFieldPop(), getSource(), isZero(), clang::interp::OffsetHelper(), operator==(), toAPValue(), and toDiagnosticString().
Creates a pointer to a field.
Definition at line 168 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 176 of file Pointer.h.
References asBlockPointer(), and Pointer().
Referenced by clang::interp::GetPtrDerivedPop().
|
inline |
Offsets a pointer inside an array.
Definition at line 149 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::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(), and toRValue().
|
inline |
Definition at line 569 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(), pointToSameBlock(), and clang::interp::MemberPointer::toPointer().
|
inline |
If this pointer has an InlineDescriptor we can use to initialize.
Definition at line 436 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 666 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 431 of file Pointer.cpp.
Referenced by clang::interp::GetPtrActiveField().
Dereferences the pointer, if it's live.
Definition at line 623 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::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 639 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 357 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(), and clang::interp::OffsetHelper().
|
inline |
Expands a pointer to the containing array, undoing narrowing.
Definition at line 225 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 317 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 308 of file Pointer.h.
References asBlockPointer(), clang::interp::BlockPointer::Base, clang::interp::InlineDescriptor::Offset, and Pointer().
Referenced by activate(), clang::interp::CallVirt(), CheckActive(), and toAPValue().
|
inline |
Returns the byte offset from the start.
Definition at line 554 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 283 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 545 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 293 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 352 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 463 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 468 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 328 of file Pointer.h.
References asIntPointer(), clang::interp::InlineDescriptor::Desc, clang::interp::IntPointer::Desc, getDeclDesc(), isIntegralPointer(), and isRoot().
Referenced by activate(), atIndex(), 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_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 572 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_strcmp(), clang::interp::interp__builtin_strlen(), isInitialized(), clang::interp::OffsetHelper(), clang::interp::SubPtr(), and toAPValue().
|
inline |
Definition at line 136 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(), and clang::interp::OffsetHelper().
|
inline |
Returns the number of elements.
Definition at line 563 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 375 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 461 of file Pointer.h.
References clang::interp::Descriptor::ElemRecord, and getFieldDesc().
Referenced by activate(), 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 369 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 296 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 338 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::EvaluationResult::checkReturnValue(), clang::interp::CheckVolatile(), getType(), clang::interp::SetThreeWayComparisonField(), toAPValue(), toDiagnosticString(), and toRValue().
Checks if two pointers can be subtracted.
Definition at line 460 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 435 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 398 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 347 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(), 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 410 of file Pointer.h.
References getFieldDesc(), isBlockPointer(), and clang::interp::Descriptor::isPrimitiveArray().
|
inline |
Definition at line 403 of file Pointer.h.
References clang::interp::InlineDescriptor::InUnion, and isBlockPointer().
Referenced by activate(), and CheckActive().
|
inline |
Checks if the object is active.
Definition at line 516 of file Pointer.h.
References clang::interp::InlineDescriptor::IsActive, isBlockPointer(), and isRoot().
Referenced by activate(), CheckActive(), clang::interp::CheckFieldsInitialized(), clang::interp::copyRecord(), and toRValue().
|
inline |
Checks if the pointer points to an array.
Definition at line 422 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 393 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 522 of file Pointer.h.
References clang::interp::InlineDescriptor::IsBase, and isField().
Referenced by clang::interp::CallVirt().
|
inline |
Definition at line 456 of file Pointer.h.
References clang::interp::Block.
Referenced by asBlockPointer(), atField(), 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(), inUnion(), 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(), pointToSameBlock(), and ~Pointer().
|
inline |
Checks if an object or a subfield is mutable.
Definition at line 538 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 649 of file Pointer.h.
References isBlockPointer(), and isPastEnd().
Referenced by deref().
|
inline |
Checks if the pointer points to a dummy value.
Definition at line 527 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 613 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 474 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 275 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 458 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 311 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 457 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 269 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(), and toRValue().
|
inline |
Checks if the field is mutable.
Definition at line 498 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 590 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 605 of file Pointer.h.
References isIntegralPointer(), and isZero().
Referenced by isDereferencable(), isOnePastEnd(), and toRValue().
|
inline |
Pointer points directly to a block.
Definition at line 428 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 480 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 495 of file Pointer.h.
References isStatic(), and isTemporary().
Referenced by CheckTemporary().
|
inline |
Checks if the storage is temporary.
Definition at line 487 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 416 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 523 of file Pointer.h.
References isField(), and clang::interp::InlineDescriptor::IsVirtualBase.
Referenced by toAPValue().
|
inline |
Definition at line 504 of file Pointer.h.
References getDeclDesc(), and isBlockPointer().
|
inline |
Checks if the pointer is null.
Definition at line 260 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 616 of file Pointer.h.
References getFieldDesc().
Referenced by isOnePastEnd().
|
inline |
Restricts the scope of an array element pointer.
Definition at line 183 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 115 of file Pointer.h.
References asBlockPointer(), asIntPointer(), clang::interp::BlockPointer::Base, isBlockPointer(), isIntegralPointer(), P, clang::interp::BlockPointer::Pointee, and clang::interp::IntPointer::Value.
Checks if both given pointers point to the same block.
Definition at line 454 of file Pointer.cpp.
References block(), and isBlockPointer().
Referenced by clang::interp::runRecordDestructor().
void Pointer::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the pointer.
Definition at line 267 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, clang::CharUnits::fromQuantity(), getArray(), clang::ASTContext::getASTRecordLayout(), getBase(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTContext::getConstantArrayType(), clang::interp::Record::getDecl(), getDeclDesc(), clang::APValue::LValueBase::getDynamicAlloc(), getFieldDesc(), getFieldOffset(), clang::ASTRecordLayout::getFieldOffset(), getIndex(), clang::interp::Descriptor::getNumElems(), getNumElems(), getRecord(), getType(), clang::ASTContext::getTypeSizeInChars(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::interp::Descriptor::isArray(), isArrayElement(), isArrayRoot(), isDummy(), isField(), isFunctionPointer(), isIntegralPointer(), isOnePastEnd(), isUnknownSizeArray(), isVirtualBaseClass(), isZero(), clang::Normal, 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 301 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 466 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 732 of file Pointer.h.
Referenced by clang::interp::DynamicAllocator::cleanup(), and hasSameArray().
FunctionPointer clang::interp::Pointer::Fn |
IntPointer clang::interp::Pointer::Int |