clang
15.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 (const Pointer &P) | |
Pointer (Pointer &&P) | |
~Pointer () | |
void | operator= (const Pointer &P) |
void | operator= (Pointer &&P) |
APValue | toAPValue () const |
Converts the pointer to an APValue. More... | |
Pointer | atIndex (unsigned Idx) const |
Offsets a pointer inside an array. More... | |
Pointer | atField (unsigned Off) const |
Creates a pointer to a field. More... | |
Pointer | narrow () const |
Restricts the scope of an array element pointer. More... | |
Pointer | expand () const |
Expands a pointer to the containing array, undoing narrowing. More... | |
bool | isZero () const |
Checks if the pointer is null. More... | |
bool | isLive () const |
Checks if the pointer is live. More... | |
bool | isField () const |
Checks if the item is a field in an object. More... | |
Descriptor * | getDeclDesc () const |
Accessor for information about the declaration site. More... | |
SourceLocation | getDeclLoc () const |
Pointer | getBase () const |
Returns a pointer to the object of which this pointer is a field. More... | |
Pointer | getArray () const |
Returns the parent array. More... | |
Descriptor * | getFieldDesc () const |
Accessors for information about the innermost field. More... | |
QualType | getType () const |
Returns the type of the innermost field. More... | |
size_t | elemSize () const |
Returns the element size of the innermost field. More... | |
size_t | getSize () const |
Returns the total size of the innermost field. More... | |
unsigned | getOffset () const |
Returns the offset into an array. More... | |
bool | inArray () const |
Checks if the innermost field is an array. More... | |
bool | inPrimitiveArray () const |
Checks if the structure is a primitive array. More... | |
bool | isUnknownSizeArray () const |
Checks if the structure is an array of unknown size. More... | |
bool | isArrayElement () const |
Checks if the pointer points to an array. More... | |
bool | isRoot () const |
Pointer points directly to a block. More... | |
Record * | getRecord () const |
Returns the record descriptor of a class. More... | |
const FieldDecl * | getField () const |
Returns the field information. More... | |
bool | isUnion () const |
Checks if the object is a union. More... | |
bool | isExtern () const |
Checks if the storage is extern. More... | |
bool | isStatic () const |
Checks if the storage is static. More... | |
bool | isTemporary () const |
Checks if the storage is temporary. More... | |
bool | isStaticTemporary () const |
Checks if the storage is a static temporary. More... | |
bool | isMutable () const |
Checks if the field is mutable. More... | |
bool | isInitialized () const |
Checks if an object was initialized. More... | |
bool | isActive () const |
Checks if the object is active. More... | |
bool | isBaseClass () const |
Checks if a structure is a base class. More... | |
bool | isConst () const |
Checks if an object or a subfield is mutable. More... | |
llvm::Optional< unsigned > | getDeclID () const |
Returns the declaration ID. More... | |
unsigned | getByteOffset () const |
Returns the byte offset from the start. More... | |
unsigned | getNumElems () const |
Returns the number of elements. More... | |
int64_t | getIndex () const |
Returns the index into an array. More... | |
bool | isOnePastEnd () const |
Checks if the index is one past end. More... | |
bool | isElementPastEnd () const |
Checks if the pointer is an out-of-bounds element pointer. More... | |
template<typename T > | |
T & | deref () const |
Dereferences the pointer, if it's live. More... | |
template<typename T > | |
T & | elem (unsigned I) const |
Dereferences a primitive element. More... | |
void | initialize () const |
Initializes a field. More... | |
void | activate () const |
Activats a field. More... | |
void | deactivate () const |
Deactivates an entire strurcutre. More... | |
void | print (llvm::raw_ostream &OS) const |
Prints the pointer. More... | |
Static Public Member Functions | |
static bool | hasSameBase (const Pointer &A, const Pointer &B) |
Checks if two pointers are comparable. More... | |
static bool | hasSameArray (const Pointer &A, const Pointer &B) |
Checks if two pointers can be subtracted. More... | |
Friends | |
class | Block |
class | DeadBlock |
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.
|
inline |
Pointer::Pointer | ( | Block * | B | ) |
Definition at line 17 of file Pointer.cpp.
Pointer::Pointer | ( | const Pointer & | P | ) |
Definition at line 19 of file Pointer.cpp.
Pointer::Pointer | ( | Pointer && | P | ) |
Definition at line 21 of file Pointer.cpp.
References clang::interp::Block::movePointer(), and P.
Pointer::~Pointer | ( | ) |
Definition at line 34 of file Pointer.cpp.
References clang::interp::Block::cleanup(), and clang::interp::Block::removePointer().
void Pointer::activate | ( | ) | const |
Activats a field.
Definition at line 177 of file Pointer.cpp.
References clang::interp::InlineDescriptor::IsActive.
Offsets a pointer inside an array.
Definition at line 55 of file Pointer.h.
References elemSize(), getDeclDesc(), getFieldDesc(), getSize(), and Pointer().
void Pointer::deactivate | ( | ) | const |
Deactivates an entire strurcutre.
Definition at line 183 of file Pointer.cpp.
|
inline |
Dereferences the pointer, if it's live.
Definition at line 277 of file Pointer.h.
References clang::interp::Block::data(), and isLive().
Referenced by clang::interp::InterpFrame::getParam(), and clang::interp::InterpFrame::setParam().
|
inline |
Dereferences a primitive element.
Definition at line 283 of file Pointer.h.
References clang::interp::Block::data().
|
inline |
Returns the element size of the innermost field.
Definition at line 178 of file Pointer.h.
References getDeclDesc(), clang::interp::Descriptor::getElemSize(), getFieldDesc(), and clang::interp::Descriptor::getSize().
Referenced by atIndex(), getIndex(), and getNumElems().
|
inline |
Expands a pointer to the containing array, undoing narrowing.
Definition at line 109 of file Pointer.h.
References clang::interp::InlineDescriptor::Desc, getDeclDesc(), getSize(), inPrimitiveArray(), clang::interp::Descriptor::IsArray, isElementPastEnd(), clang::interp::InlineDescriptor::Offset, and Pointer().
|
inline |
Returns the parent array.
Definition at line 158 of file Pointer.h.
References Pointer().
Referenced by toAPValue().
|
inline |
Returns a pointer to the object of which this pointer is a field.
Definition at line 148 of file Pointer.h.
References clang::interp::InlineDescriptor::Offset, and Pointer().
Referenced by toAPValue().
|
inline |
|
inline |
Accessor for information about the declaration site.
Definition at line 144 of file Pointer.h.
References clang::interp::Block::Desc.
Referenced by atIndex(), elemSize(), expand(), getDeclLoc(), getFieldDesc(), isConst(), and toAPValue().
|
inline |
Returns the declaration ID.
Definition at line 249 of file Pointer.h.
References clang::interp::Block::getDeclID().
|
inline |
Definition at line 145 of file Pointer.h.
References getDeclDesc(), and clang::interp::Descriptor::getLocation().
|
inline |
Returns the field information.
Definition at line 220 of file Pointer.h.
References clang::interp::Descriptor::asFieldDecl(), and getFieldDesc().
|
inline |
Accessors for information about the innermost field.
Definition at line 168 of file Pointer.h.
References clang::interp::InlineDescriptor::Desc, and getDeclDesc().
Referenced by atIndex(), elemSize(), getField(), getOffset(), getRecord(), getSize(), getType(), hasSameArray(), inArray(), initialize(), inPrimitiveArray(), isInitialized(), isUnknownSizeArray(), narrow(), and toAPValue().
|
inline |
Returns the index into an array.
Definition at line 260 of file Pointer.h.
References elemSize(), getOffset(), and isElementPastEnd().
Referenced by initialize(), isInitialized(), and toAPValue().
|
inline |
Returns the number of elements.
Definition at line 257 of file Pointer.h.
References elemSize(), and getSize().
|
inline |
Returns the offset into an array.
Definition at line 187 of file Pointer.h.
References getFieldDesc().
Referenced by getIndex(), and isOnePastEnd().
|
inline |
Returns the record descriptor of a class.
Definition at line 218 of file Pointer.h.
References clang::interp::Descriptor::ElemRecord, and getFieldDesc().
|
inline |
Returns the total size of the innermost field.
Definition at line 184 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::getSize().
Referenced by atIndex(), expand(), getNumElems(), and isOnePastEnd().
|
inline |
Returns the type of the innermost field.
Definition at line 175 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::getType().
Checks if two pointers can be subtracted.
Definition at line 191 of file Pointer.cpp.
References getFieldDesc(), and clang::interp::Descriptor::IsArray.
Checks if two pointers are comparable.
Definition at line 187 of file Pointer.cpp.
|
inline |
Checks if the innermost field is an array.
Definition at line 203 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::IsArray.
void Pointer::initialize | ( | ) | const |
Initializes a field.
Definition at line 154 of file Pointer.cpp.
References clang::interp::InitMap::allocate(), getFieldDesc(), getIndex(), clang::interp::Descriptor::getNumElems(), clang::interp::InitMap::initialize(), clang::interp::InlineDescriptor::IsInitialized, clang::interp::Descriptor::isPrimitiveArray(), and clang::interp::Block::IsStatic.
|
inline |
Checks if the structure is a primitive array.
Definition at line 205 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::isPrimitiveArray().
|
inline |
Checks if the object is active.
Definition at line 239 of file Pointer.h.
References clang::interp::InlineDescriptor::IsActive.
|
inline |
Checks if the pointer points to an array.
Definition at line 211 of file Pointer.h.
Referenced by toAPValue().
|
inline |
Checks if a structure is a base class.
Definition at line 241 of file Pointer.h.
References clang::interp::InlineDescriptor::IsBase, and isField().
|
inline |
Checks if an object or a subfield is mutable.
Definition at line 244 of file Pointer.h.
References getDeclDesc(), clang::interp::Descriptor::IsConst, and clang::interp::InlineDescriptor::IsConst.
|
inline |
Checks if the pointer is an out-of-bounds element pointer.
Definition at line 274 of file Pointer.h.
Referenced by expand(), getIndex(), and isOnePastEnd().
|
inline |
Checks if the storage is extern.
Definition at line 226 of file Pointer.h.
References clang::interp::Block::isExtern().
|
inline |
Checks if the item is a field in an object.
Definition at line 141 of file Pointer.h.
Referenced by isBaseClass(), and toAPValue().
bool Pointer::isInitialized | ( | ) | const |
Checks if an object was initialized.
Definition at line 135 of file Pointer.cpp.
References getFieldDesc(), getIndex(), clang::interp::InlineDescriptor::IsInitialized, clang::interp::InitMap::isInitialized(), clang::interp::Descriptor::isPrimitiveArray(), and clang::interp::Block::IsStatic.
|
inline |
Checks if the pointer is live.
Definition at line 139 of file Pointer.h.
References clang::interp::Block::IsDead.
Referenced by deref().
|
inline |
Checks if the field is mutable.
Definition at line 235 of file Pointer.h.
References clang::interp::InlineDescriptor::IsMutable.
|
inline |
Checks if the index is one past end.
Definition at line 269 of file Pointer.h.
References getOffset(), getSize(), and isElementPastEnd().
Referenced by narrow(), and toAPValue().
|
inline |
|
inline |
Checks if the storage is static.
Definition at line 228 of file Pointer.h.
References clang::interp::Block::isStatic().
Referenced by isStaticTemporary().
|
inline |
Checks if the storage is a static temporary.
Definition at line 232 of file Pointer.h.
References isStatic(), and isTemporary().
|
inline |
Checks if the storage is temporary.
Definition at line 230 of file Pointer.h.
References clang::interp::Block::isTemporary().
Referenced by 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 207 of file Pointer.h.
References getFieldDesc(), and clang::interp::Descriptor::isUnknownSizeArray().
Referenced by narrow(), and toAPValue().
|
inline |
Checks if the pointer is null.
Definition at line 137 of file Pointer.h.
Referenced by narrow(), and toAPValue().
|
inline |
Restricts the scope of an array element pointer.
Definition at line 73 of file Pointer.h.
References getFieldDesc(), inPrimitiveArray(), isOnePastEnd(), isUnknownSizeArray(), isZero(), and Pointer().
void Pointer::operator= | ( | const Pointer & | P | ) |
Definition at line 41 of file Pointer.cpp.
References clang::interp::Block::addPointer(), clang::interp::Block::cleanup(), Offset, P, and clang::interp::Block::removePointer().
void Pointer::operator= | ( | Pointer && | P | ) |
Definition at line 58 of file Pointer.cpp.
References clang::interp::Block::cleanup(), clang::interp::Block::movePointer(), Offset, P, and clang::interp::Block::removePointer().
|
inline |
Prints the pointer.
Definition at line 300 of file Pointer.h.
References clang::interp::Block::getSize().
APValue Pointer::toAPValue | ( | ) | const |
Converts the pointer to an APValue.
Definition at line 75 of file Pointer.cpp.
References clang::APValue::LValuePathEntry::ArrayIndex(), clang::interp::Descriptor::asDecl(), clang::interp::Descriptor::asExpr(), clang::interp::Descriptor::asValueDecl(), getArray(), getBase(), getDeclDesc(), getFieldDesc(), getIndex(), isArrayElement(), isField(), isOnePastEnd(), isUnknownSizeArray(), isZero(), Offset, and clang::CharUnits::Zero().