25 :
Pointer(Pointee, BaseAndOffset, BaseAndOffset) {}
30 : Pointee(
P.Pointee),
Base(
P.
Base), Offset(
P.Offset) {
36 : Pointee(Pointee),
Base(
Base), Offset(Offset) {
37 assert((
Base == RootPtrMark ||
Base %
alignof(
void *) == 0) &&
"wrong base");
91 Base =
static_cast<const Expr *
>(
nullptr);
100 else if (
auto *E = Desc->
asExpr())
103 llvm_unreachable(
"Invalid allocation type");
109 IsOnePastEnd =
false;
111 }
else if (Desc->
asExpr()) {
113 IsOnePastEnd =
false;
127 bool IsVirtual =
false;
131 if (
const auto *BaseOrMember = Desc->
asDecl()) {
136 llvm_unreachable(
"Invalid field type");
148 std::reverse(Path.begin(), Path.end());
150 return APValue(
Base, Offset, Path, IsOnePastEnd, IsNullPtr);
161 assert(Pointee &&
"Cannot check if null pointer was initialized");
181 assert(Pointee &&
"Cannot initialize null pointer");
204 assert(
Base != 0 &&
"Only composite fields can be initialised");
210 assert(
Base != 0 &&
"Only composite fields can be initialised");
219 return A.Pointee == B.Pointee;
231 llvm_unreachable(
"Unhandled PrimType?");
#define TYPE_SWITCH(Expr, B)
A non-discriminated union of a base, field, or array index.
static LValuePathEntry ArrayIndex(uint64_t Index)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
std::string getAsString(const ASTContext &Ctx, QualType Ty) const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CharUnits - This is an opaque type for sizes expressed in character units.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
This represents one expression.
A memory block, either on the stack or in the heap.
void addPointer(Pointer *P)
Pointer chain management.
void replacePointer(Pointer *Old, Pointer *New)
void removePointer(Pointer *P)
void cleanup()
Deletes a dead block at the end of its lifetime.
Holds all information required to evaluate constexpr code in a module.
std::optional< PrimType > classify(QualType T) const
Classifies an expression.
A pointer to a memory block, live or dead.
static bool hasSameBase(const Pointer &A, const Pointer &B)
Checks if two pointers are comparable.
void deactivate() const
Deactivates an entire strurcutre.
bool isInitialized() const
Checks if an object was initialized.
bool isStatic() const
Checks if the storage is static.
int64_t getIndex() const
Returns the index into an array.
Pointer atField(unsigned Off) const
Creates a pointer to a field.
Pointer getArray() const
Returns the parent array.
bool isUnknownSizeArray() const
Checks if the structure is an array of unknown size.
void activate() const
Activats a field.
void operator=(const Pointer &P)
QualType getType() const
Returns the type of the innermost field.
bool isArrayElement() const
Checks if the pointer points to an array.
Descriptor * getFieldDesc() const
Accessors for information about the innermost field.
Pointer getBase() const
Returns a pointer to the object of which this pointer is a field.
APValue toRValue(const Context &Ctx) const
Converts the pointer to an APValue that is an rvalue.
std::string toDiagnosticString(const ASTContext &Ctx) const
Converts the pointer to a string usable in diagnostics.
bool isZero() const
Checks if the pointer is null.
Descriptor * getDeclDesc() const
Accessor for information about the declaration site.
bool isOnePastEnd() const
Checks if the index is one past end.
static bool hasSameArray(const Pointer &A, const Pointer &B)
Checks if two pointers can be subtracted.
APValue toAPValue() const
Converts the pointer to an APValue.
void initialize() const
Initializes a field.
bool isField() const
Checks if the item is a field in an object.
const Record * getRecord() const
Returns the record descriptor of a class.
Structure/Class descriptor.
unsigned getNumBases() const
const Field * getField(const FieldDecl *FD) const
Returns a field.
unsigned getNumFields() const
const Base * getBase(const RecordDecl *FD) const
Returns a base descriptor.
PrimType
Enumeration of the primitive types of the VM.
@ Result
The result type of a method or function.
Describes a memory block created by an allocation site.
unsigned getNumElems() const
Returns the number of elements stored in the block.
const ValueDecl * asValueDecl() const
const Decl * asDecl() const
const bool IsArray
Flag indicating if the block is an array.
bool isPrimitiveArray() const
Checks if the descriptor is of an array of primitives.
const Expr * asExpr() const
Bitfield tracking the initialisation status of elements of primitive arrays.
static InitMap * allocate(unsigned N)
Allocates a map holding N elements.
bool isInitialized(unsigned I) const
Checks if an element was initialized.
bool initialize(unsigned I)
Initializes an element. Returns true when object if fully initialized.
unsigned IsActive
Flag indicating if the field is the active member of a union.
unsigned IsInitialized
For primitive fields, it indicates if the field was initialized.