13#ifndef LLVM_CLANG_AST_INTERP_DESCRIPTOR_H
14#define LLVM_CLANG_AST_INTERP_DESCRIPTOR_H
26using DeclTy = llvm::PointerUnion<const Decl *, const Expr *>;
32 bool IsMutable,
bool IsActive,
45 char *DstFieldPtr,
const Descriptor *FieldDesc);
81 const unsigned ElemSize;
85 const unsigned MDSize;
87 const unsigned AllocSize;
90 static constexpr unsigned UnknownSizeMark = (
unsigned)-1;
146 return dyn_cast_if_present<ValueDecl>(
asDecl());
150 return dyn_cast_if_present<FieldDecl>(
asDecl());
154 return dyn_cast_if_present<RecordDecl>(
asDecl());
198 static constexpr uint64_t PER_FIELD =
sizeof(T) *
CHAR_BIT;
205 const T *data()
const;
219 unsigned UninitFields;
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Represents a member of a struct/union/class.
A (possibly-)qualified type.
Represents a struct/union/class.
Encodes a location in the source.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
A memory block, either on the stack or in the heap.
Structure/Class descriptor.
void(*)(Block *Storage, char *FieldPtr, const Descriptor *FieldDesc) BlockDtorFn
Invoked when a block is destroyed.
void(*)(Block *Storage, char *SrcFieldPtr, char *DstFieldPtr, const Descriptor *FieldDesc) BlockMoveFn
Invoked when a block with pointers referencing it goes out of scope.
PrimType
Enumeration of the primitive types of the VM.
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
void(*)(Block *Storage, char *FieldPtr, bool IsConst, bool IsMutable, bool IsActive, const Descriptor *FieldDesc) BlockCtorFn
Invoked whenever a block is created.
Token to denote structures of unknown size.
Describes a memory block created by an allocation site.
const bool IsConst
Flag indicating if the block is mutable.
unsigned getAllocSize() const
Returns the allocated size, including metadata.
unsigned getNumElems() const
Returns the number of elements stored in the block.
unsigned getSize() const
Returns the size of the object without metadata.
bool isPrimitive() const
Checks if the descriptor is of a primitive.
const RecordDecl * asRecordDecl() const
const ValueDecl * asValueDecl() const
const BlockCtorFn CtorFn
Storage management methods.
const Decl * asDecl() const
unsigned getMetadataSize() const
Returns the size of the metadata.
SourceLocation getLocation() const
const bool IsMutable
Flag indicating if a field is mutable.
static constexpr MetadataSize InlineDescMD
std::optional< unsigned > MetadataSize
bool isUnknownSizeArray() const
Checks if the descriptor is of an array of unknown size.
unsigned getElemSize() const
returns the size of an element when the structure is viewed as an array.
const bool IsArray
Flag indicating if the block is an array.
Descriptor *const ElemDesc
Descriptor of the array element.
bool isPrimitiveArray() const
Checks if the descriptor is of an array of primitives.
bool isZeroSizeArray() const
Checks if the descriptor is of an array of zero size.
const FieldDecl * asFieldDecl() const
const bool IsTemporary
Flag indicating if the block is a temporary.
const Expr * asExpr() const
Record *const ElemRecord
Pointer to the record, if block contains records.
bool isArray() const
Checks if the descriptor is of an array.
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.
Inline descriptor embedded in structures and arrays.
unsigned IsActive
Flag indicating if the field is the active member of a union.
unsigned IsBase
Flag indicating if the field is an embedded base class.
unsigned Offset
Offset inside the structure/array.
unsigned IsInitialized
For primitive fields, it indicates if the field was initialized.
unsigned IsConst
Flag indicating if the storage is constant or not.
unsigned IsFieldMutable
Flag indicating if the field is mutable (if in a record).