clang
19.0.0git
|
Describes a memory block created by an allocation site. More...
#include "/home/runner/work/llvm/llvm/repo/clang/lib/AST/Interp/Descriptor.h"
Classes | |
struct | UnknownSize |
Token to denote structures of unknown size. More... | |
Public Types | |
using | MetadataSize = std::optional< unsigned > |
Public Member Functions | |
Descriptor (const DeclTy &D, PrimType Type, MetadataSize MD, bool IsConst, bool IsTemporary, bool IsMutable) | |
Allocates a descriptor for a primitive. More... | |
Descriptor (const DeclTy &D, PrimType Type, MetadataSize MD, size_t NumElems, bool IsConst, bool IsTemporary, bool IsMutable) | |
Allocates a descriptor for an array of primitives. More... | |
Descriptor (const DeclTy &D, PrimType Type, MetadataSize MDSize, bool IsTemporary, UnknownSize) | |
Allocates a descriptor for an array of primitives of unknown size. More... | |
Descriptor (const DeclTy &D, const Descriptor *Elem, MetadataSize MD, unsigned NumElems, bool IsConst, bool IsTemporary, bool IsMutable) | |
Allocates a descriptor for an array of composites. More... | |
Descriptor (const DeclTy &D, const Descriptor *Elem, MetadataSize MD, bool IsTemporary, UnknownSize) | |
Allocates a descriptor for an array of composites of unknown size. More... | |
Descriptor (const DeclTy &D, const Record *R, MetadataSize MD, bool IsConst, bool IsTemporary, bool IsMutable) | |
Allocates a descriptor for a record. More... | |
Descriptor (const DeclTy &D) | |
Allocates a dummy descriptor. More... | |
void | makeDummy () |
Make this descriptor a dummy descriptor. More... | |
QualType | getType () const |
QualType | getElemQualType () const |
SourceLocation | getLocation () const |
const Decl * | asDecl () const |
const Expr * | asExpr () const |
const DeclTy & | getSource () const |
const ValueDecl * | asValueDecl () const |
const VarDecl * | asVarDecl () const |
const FieldDecl * | asFieldDecl () const |
const RecordDecl * | asRecordDecl () const |
unsigned | getSize () const |
Returns the size of the object without metadata. More... | |
PrimType | getPrimType () const |
unsigned | getAllocSize () const |
Returns the allocated size, including metadata. More... | |
unsigned | getElemSize () const |
returns the size of an element when the structure is viewed as an array. More... | |
unsigned | getMetadataSize () const |
Returns the size of the metadata. More... | |
unsigned | getNumElems () const |
Returns the number of elements stored in the block. More... | |
bool | isPrimitiveArray () const |
Checks if the descriptor is of an array of primitives. More... | |
bool | isCompositeArray () const |
Checks if the descriptor is of an array of composites. More... | |
bool | isZeroSizeArray () const |
Checks if the descriptor is of an array of zero size. More... | |
bool | isUnknownSizeArray () const |
Checks if the descriptor is of an array of unknown size. More... | |
bool | isPrimitive () const |
Checks if the descriptor is of a primitive. More... | |
bool | isArray () const |
Checks if the descriptor is of an array. More... | |
bool | isRecord () const |
Checks if the descriptor is of a record. More... | |
bool | isDummy () const |
Checks if this is a dummy descriptor. More... | |
void | dump () const |
void | dump (llvm::raw_ostream &OS) const |
Public Attributes | |
const Record *const | ElemRecord = nullptr |
Pointer to the record, if block contains records. More... | |
const Descriptor *const | ElemDesc = nullptr |
Descriptor of the array element. More... | |
const std::optional< PrimType > | PrimT = std::nullopt |
The primitive type this descriptor was created for, or the primitive element type in case this is a primitive array. More... | |
const bool | IsConst = false |
Flag indicating if the block is mutable. More... | |
const bool | IsMutable = false |
Flag indicating if a field is mutable. More... | |
const bool | IsTemporary = false |
Flag indicating if the block is a temporary. More... | |
const bool | IsArray = false |
Flag indicating if the block is an array. More... | |
bool | IsDummy = false |
Flag indicating if this is a dummy descriptor. More... | |
const BlockCtorFn | CtorFn = nullptr |
Storage management methods. More... | |
const BlockDtorFn | DtorFn = nullptr |
const BlockMoveFn | MoveFn = nullptr |
Static Public Attributes | |
static constexpr MetadataSize | InlineDescMD = sizeof(InlineDescriptor) |
Describes a memory block created by an allocation site.
Definition at line 91 of file Descriptor.h.
using clang::interp::Descriptor::MetadataSize = std::optional<unsigned> |
Definition at line 111 of file Descriptor.h.
Descriptor::Descriptor | ( | const DeclTy & | D, |
PrimType | Type, | ||
MetadataSize | MD, | ||
size_t | NumElems, | ||
bool | IsConst, | ||
bool | IsTemporary, | ||
bool | IsMutable | ||
) |
Allocates a descriptor for an array of primitives.
Primitive arrays.
Definition at line 282 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D, |
PrimType | Type, | ||
MetadataSize | MDSize, | ||
bool | IsTemporary, | ||
UnknownSize | |||
) |
Allocates a descriptor for an array of primitives of unknown size.
Primitive unknown-size arrays.
Definition at line 295 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D, |
const Descriptor * | Elem, | ||
MetadataSize | MD, | ||
unsigned | NumElems, | ||
bool | IsConst, | ||
bool | IsTemporary, | ||
bool | IsMutable | ||
) |
Allocates a descriptor for an array of composites.
Arrays of composite elements.
Definition at line 307 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D, |
const Descriptor * | Elem, | ||
MetadataSize | MD, | ||
bool | IsTemporary, | ||
UnknownSize | |||
) |
Allocates a descriptor for an array of composites of unknown size.
Unknown-size arrays of composite elements.
Definition at line 320 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D, |
const Record * | R, | ||
MetadataSize | MD, | ||
bool | IsConst, | ||
bool | IsTemporary, | ||
bool | IsMutable | ||
) |
Allocates a descriptor for a record.
Composite records.
Definition at line 331 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D | ) |
|
inline |
Definition at line 172 of file Descriptor.h.
Referenced by asFieldDecl(), asRecordDecl(), asValueDecl(), asVarDecl(), dump(), getType(), clang::interp::Pointer::isField(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 173 of file Descriptor.h.
Referenced by dump(), getType(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 184 of file Descriptor.h.
References asDecl().
Referenced by clang::interp::Pointer::getField(), and clang::interp::Pointer::toRValue().
|
inline |
Definition at line 188 of file Descriptor.h.
References asDecl().
|
inline |
Definition at line 176 of file Descriptor.h.
References asDecl().
Referenced by getType(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 180 of file Descriptor.h.
References asDecl().
LLVM_DUMP_METHOD void Descriptor::dump | ( | ) | const |
Definition at line 177 of file Disasm.cpp.
Referenced by clang::interp::InlineDescriptor::dump(), and clang::interp::Program::dump().
LLVM_DUMP_METHOD void Descriptor::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 182 of file Disasm.cpp.
References asDecl(), asExpr(), isCompositeArray(), isDummy(), isPrimitive(), isPrimitiveArray(), isRecord(), isUnknownSizeArray(), and isZeroSizeArray().
|
inline |
Returns the allocated size, including metadata.
Definition at line 204 of file Descriptor.h.
Referenced by clang::interp::Program::createDescriptor(), clang::interp::ByteCodeEmitter::createLocal(), clang::interp::EvalEmitter::createLocal(), ctorArrayDesc(), dtorArrayDesc(), clang::interp::Program::getOrCreateDummy(), clang::interp::Program::getOrCreateRecord(), clang::interp::Block::getSize(), clang::interp::Block::invokeCtor(), and moveArrayDesc().
QualType Descriptor::getElemQualType | ( | ) | const |
Definition at line 359 of file Descriptor.cpp.
|
inline |
returns the size of an element when the structure is viewed as an array.
Definition at line 206 of file Descriptor.h.
Referenced by clang::interp::Pointer::elemSize(), and getNumElems().
SourceLocation Descriptor::getLocation | ( | ) | const |
Definition at line 365 of file Descriptor.cpp.
Referenced by clang::interp::Pointer::getDeclLoc().
|
inline |
Returns the size of the metadata.
Definition at line 208 of file Descriptor.h.
Referenced by clang::interp::Block::data(), and clang::interp::InterpState::deallocate().
|
inline |
Returns the number of elements stored in the block.
Definition at line 211 of file Descriptor.h.
References getElemSize(), and getSize().
Referenced by ctorArrayDesc(), ctorArrayTy(), dtorArrayDesc(), dtorArrayTy(), clang::interp::Pointer::initialize(), moveArrayDesc(), and moveArrayTy().
|
inline |
Definition at line 198 of file Descriptor.h.
References isPrimitive(), isPrimitiveArray(), and PrimT.
Referenced by clang::interp::Program::dump().
|
inline |
Returns the size of the object without metadata.
Definition at line 193 of file Descriptor.h.
References isUnknownSizeArray().
Referenced by clang::interp::Pointer::elemSize(), getNumElems(), and clang::interp::Pointer::getSize().
|
inline |
Definition at line 174 of file Descriptor.h.
Referenced by clang::interp::Pointer::getSource().
QualType Descriptor::getType | ( | ) | const |
Definition at line 349 of file Descriptor.cpp.
References asDecl(), asExpr(), asValueDecl(), and clang::T.
Referenced by getElemQualType(), and clang::interp::Pointer::getType().
|
inline |
Checks if the descriptor is of an array.
Definition at line 228 of file Descriptor.h.
References IsArray.
Referenced by getElemQualType().
|
inline |
Checks if the descriptor is of an array of composites.
Definition at line 218 of file Descriptor.h.
References ElemDesc, and IsArray.
Referenced by dump().
|
inline |
Checks if this is a dummy descriptor.
Definition at line 232 of file Descriptor.h.
References IsDummy.
Referenced by dump(), clang::interp::Program::dump(), clang::interp::Program::getOrCreateDummy(), and clang::interp::Pointer::isDummy().
|
inline |
Checks if the descriptor is of a primitive.
Definition at line 225 of file Descriptor.h.
References ElemRecord, and IsArray.
Referenced by dump(), clang::interp::Program::dump(), and getPrimType().
|
inline |
Checks if the descriptor is of an array of primitives.
Definition at line 216 of file Descriptor.h.
References ElemDesc, and IsArray.
Referenced by dump(), getPrimType(), clang::interp::Pointer::initialize(), clang::interp::Pointer::inPrimitiveArray(), and clang::interp::Pointer::isInitialized().
|
inline |
Checks if the descriptor is of a record.
Definition at line 230 of file Descriptor.h.
References ElemRecord, and IsArray.
Referenced by dump().
|
inline |
Checks if the descriptor is of an array of unknown size.
Definition at line 222 of file Descriptor.h.
Referenced by dump(), getSize(), and clang::interp::Pointer::isUnknownSizeArray().
|
inline |
Checks if the descriptor is of an array of zero size.
Definition at line 220 of file Descriptor.h.
Referenced by dump(), and clang::interp::Pointer::isZeroSizeArray().
|
inline |
Make this descriptor a dummy descriptor.
Definition at line 166 of file Descriptor.h.
References IsDummy.
Referenced by clang::interp::Program::getOrCreateDummy().
const BlockCtorFn clang::interp::Descriptor::CtorFn = nullptr |
Storage management methods.
Definition at line 134 of file Descriptor.h.
Referenced by ctorArrayDesc(), initField(), and clang::interp::Block::invokeCtor().
const BlockDtorFn clang::interp::Descriptor::DtorFn = nullptr |
Definition at line 135 of file Descriptor.h.
Referenced by dtorArrayDesc(), and clang::interp::Block::invokeDtor().
const Descriptor* const clang::interp::Descriptor::ElemDesc = nullptr |
Descriptor of the array element.
Definition at line 117 of file Descriptor.h.
Referenced by ctorArrayDesc(), dtorArrayDesc(), clang::interp::Pointer::getElemRecord(), isCompositeArray(), isPrimitiveArray(), and moveArrayDesc().
const Record* const clang::interp::Descriptor::ElemRecord = nullptr |
Pointer to the record, if block contains records.
Definition at line 115 of file Descriptor.h.
Referenced by ctorRecord(), dtorRecord(), clang::interp::Pointer::getElemRecord(), clang::interp::Pointer::getRecord(), initBase(), isPrimitive(), isRecord(), and moveRecord().
|
staticconstexpr |
Definition at line 112 of file Descriptor.h.
Referenced by clang::interp::ByteCodeExprGen< Emitter >::allocateLocal(), clang::interp::ByteCodeExprGen< Emitter >::allocateLocalPrimitive(), and clang::interp::ByteCodeExprGen< Emitter >::VisitCastExpr().
Flag indicating if the block is an array.
Definition at line 129 of file Descriptor.h.
Referenced by clang::interp::Pointer::expand(), clang::interp::Pointer::hasSameArray(), clang::interp::Pointer::inArray(), initBase(), initField(), isArray(), isCompositeArray(), isPrimitive(), isPrimitiveArray(), and isRecord().
Flag indicating if the block is mutable.
Definition at line 123 of file Descriptor.h.
Referenced by ctorArrayDesc(), initBase(), initField(), clang::interp::Block::invokeCtor(), and clang::interp::Pointer::isConst().
Flag indicating if this is a dummy descriptor.
Definition at line 131 of file Descriptor.h.
Referenced by isDummy(), and makeDummy().
Flag indicating if a field is mutable.
Definition at line 125 of file Descriptor.h.
Referenced by ctorArrayDesc(), initBase(), initField(), and clang::interp::Block::invokeCtor().
Flag indicating if the block is a temporary.
Definition at line 127 of file Descriptor.h.
Referenced by clang::interp::Block::isTemporary().
const BlockMoveFn clang::interp::Descriptor::MoveFn = nullptr |
Definition at line 136 of file Descriptor.h.
Referenced by clang::interp::InterpState::deallocate(), and moveArrayDesc().
const std::optional<PrimType> clang::interp::Descriptor::PrimT = std::nullopt |
The primitive type this descriptor was created for, or the primitive element type in case this is a primitive array.
Definition at line 121 of file Descriptor.h.
Referenced by getPrimType().