clang 20.0.0git
|
Describes a memory block created by an allocation site. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/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. | |
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. | |
Descriptor (const DeclTy &D, PrimType Type, MetadataSize MDSize, bool IsTemporary, UnknownSize) | |
Allocates a descriptor for an array of primitives of unknown size. | |
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. | |
Descriptor (const DeclTy &D, const Descriptor *Elem, MetadataSize MD, bool IsTemporary, UnknownSize) | |
Allocates a descriptor for an array of composites of unknown size. | |
Descriptor (const DeclTy &D, const Record *R, MetadataSize MD, bool IsConst, bool IsTemporary, bool IsMutable) | |
Allocates a descriptor for a record. | |
Descriptor (const DeclTy &D) | |
Allocates a dummy descriptor. | |
void | makeDummy () |
Make this descriptor a dummy descriptor. | |
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. | |
PrimType | getPrimType () const |
unsigned | getAllocSize () const |
Returns the allocated size, including metadata. | |
unsigned | getElemSize () const |
returns the size of an element when the structure is viewed as an array. | |
unsigned | getMetadataSize () const |
Returns the size of the metadata. | |
unsigned | getNumElems () const |
Returns the number of elements stored in the block. | |
bool | isPrimitiveArray () const |
Checks if the descriptor is of an array of primitives. | |
bool | isCompositeArray () const |
Checks if the descriptor is of an array of composites. | |
bool | isZeroSizeArray () const |
Checks if the descriptor is of an array of zero size. | |
bool | isUnknownSizeArray () const |
Checks if the descriptor is of an array of unknown size. | |
bool | isPrimitive () const |
Checks if the descriptor is of a primitive. | |
bool | isArray () const |
Checks if the descriptor is of an array. | |
bool | isRecord () const |
Checks if the descriptor is of a record. | |
bool | isUnion () const |
Checks if the descriptor is of a union. | |
bool | isDummy () const |
Checks if this is a dummy descriptor. | |
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. | |
const Descriptor *const | ElemDesc = nullptr |
Descriptor of the array element. | |
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. | |
const bool | IsConst = false |
Flag indicating if the block is mutable. | |
const bool | IsMutable = false |
Flag indicating if a field is mutable. | |
const bool | IsTemporary = false |
Flag indicating if the block is a temporary. | |
const bool | IsArray = false |
Flag indicating if the block is an array. | |
bool | IsDummy = false |
Flag indicating if this is a dummy descriptor. | |
const BlockCtorFn | CtorFn = nullptr |
Storage management methods. | |
const BlockDtorFn | DtorFn = nullptr |
const BlockMoveFn | MoveFn = nullptr |
Static Public Attributes | |
static constexpr MetadataSize | InlineDescMD = sizeof(InlineDescriptor) |
static constexpr MetadataSize | GlobalMD = sizeof(GlobalInlineDescriptor) |
static constexpr unsigned | MaxArrayElemBytes |
Maximum number of bytes to be used for array elements. | |
Describes a memory block created by an allocation site.
Definition at line 111 of file Descriptor.h.
using clang::interp::Descriptor::MetadataSize = std::optional<unsigned> |
Definition at line 131 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 326 of file Descriptor.cpp.
References MaxArrayElemBytes.
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 340 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 352 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 365 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 376 of file Descriptor.cpp.
Descriptor::Descriptor | ( | const DeclTy & | D | ) |
|
inline |
Definition at line 198 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 199 of file Descriptor.h.
Referenced by clang::interp::DynamicAllocator::allocate(), dump(), clang::interp::Program::dump(), clang::interp::Free(), getType(), clang::interp::InitGlobalTemp(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 210 of file Descriptor.h.
References asDecl().
Referenced by clang::interp::Pointer::getField(), and clang::interp::Pointer::toRValue().
|
inline |
Definition at line 214 of file Descriptor.h.
References asDecl().
|
inline |
Definition at line 202 of file Descriptor.h.
References asDecl().
Referenced by clang::interp::CheckDummy(), clang::interp::CheckExtern(), clang::interp::CheckGlobalInitialized(), getType(), clang::interp::interp__builtin_is_aligned_up_down(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 206 of file Descriptor.h.
References asDecl().
Referenced by clang::interp::CheckConstant(), clang::interp::CheckExtern(), and clang::interp::CheckInitialized().
LLVM_DUMP_METHOD void Descriptor::dump | ( | ) | const |
Definition at line 209 of file Disasm.cpp.
References dump().
Referenced by dump(), clang::interp::InlineDescriptor::dump(), clang::interp::Block::dump(), and clang::interp::Program::dump().
LLVM_DUMP_METHOD void Descriptor::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 214 of file Disasm.cpp.
References asDecl(), asExpr(), isCompositeArray(), isDummy(), isPrimitive(), isPrimitiveArray(), isRecord(), isUnion(), isUnknownSizeArray(), and isZeroSizeArray().
|
inline |
Returns the allocated size, including metadata.
Definition at line 230 of file Descriptor.h.
Referenced by clang::interp::Program::createDescriptor(), clang::interp::Program::createGlobalString(), clang::interp::Program::getOrCreateDummy(), clang::interp::Program::getOrCreateRecord(), clang::interp::Block::getSize(), and clang::interp::Block::invokeCtor().
QualType Descriptor::getElemQualType | ( | ) | const |
Definition at line 404 of file Descriptor.cpp.
References clang::Type::getAs(), clang::Type::getAsArrayTypeUnsafe(), getType(), isArray(), and clang::T.
|
inline |
returns the size of an element when the structure is viewed as an array.
Definition at line 232 of file Descriptor.h.
Referenced by clang::interp::Pointer::elemSize(), and getNumElems().
SourceLocation Descriptor::getLocation | ( | ) | const |
Definition at line 416 of file Descriptor.cpp.
References D, E, clang::Expr::getExprLoc(), and clang::Decl::getLocation().
Referenced by clang::interp::CheckFieldsInitialized(), and clang::interp::Pointer::getDeclLoc().
|
inline |
Returns the size of the metadata.
Definition at line 234 of file Descriptor.h.
Referenced by clang::interp::CheckDowncast(), clang::interp::Block::data(), clang::interp::InterpState::deallocate(), clang::interp::Pointer::expand(), and clang::interp::MemberPointer::toPointer().
|
inline |
Returns the number of elements stored in the block.
Definition at line 237 of file Descriptor.h.
References getElemSize(), and getSize().
Referenced by clang::interp::collectBlocks(), clang::interp::copyComposite(), clang::interp::Pointer::initialize(), clang::interp::RunDestructors(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 224 of file Descriptor.h.
References isPrimitive(), isPrimitiveArray(), and PrimT.
Referenced by clang::interp::collectBlocks(), clang::interp::copyComposite(), and clang::interp::Program::dump().
|
inline |
Returns the size of the object without metadata.
Definition at line 219 of file Descriptor.h.
References isUnknownSizeArray().
Referenced by clang::interp::AllocCN(), clang::interp::Pointer::elemSize(), getNumElems(), and clang::interp::Pointer::getSize().
|
inline |
Definition at line 200 of file Descriptor.h.
Referenced by clang::interp::Pointer::getSource().
QualType Descriptor::getType | ( | ) | const |
Definition at line 394 of file Descriptor.cpp.
References asDecl(), asExpr(), asValueDecl(), D, E, clang::Expr::getType(), and clang::T.
Referenced by CheckTemporary(), getElemQualType(), and clang::interp::Pointer::getType().
|
inline |
Checks if the descriptor is of an array.
Definition at line 254 of file Descriptor.h.
References IsArray.
Referenced by getElemQualType(), and clang::interp::Pointer::toAPValue().
|
inline |
Checks if the descriptor is of an array of composites.
Definition at line 244 of file Descriptor.h.
References ElemDesc, and IsArray.
Referenced by clang::interp::collectBlocks(), dump(), and clang::interp::RunDestructors().
|
inline |
Checks if this is a dummy descriptor.
Definition at line 260 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 251 of file Descriptor.h.
References ElemRecord, and IsArray.
Referenced by clang::interp::collectBlocks(), clang::interp::copyComposite(), dump(), clang::interp::Program::dump(), getPrimType(), and clang::interp::RunDestructors().
|
inline |
Checks if the descriptor is of an array of primitives.
Definition at line 242 of file Descriptor.h.
References ElemDesc, and IsArray.
Referenced by clang::interp::collectBlocks(), clang::interp::copyComposite(), dump(), getPrimType(), clang::interp::Pointer::initialize(), clang::interp::Pointer::inPrimitiveArray(), clang::interp::interp__builtin_nan(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::Pointer::isInitialized(), and clang::interp::RunDestructors().
|
inline |
Checks if the descriptor is of a record.
Definition at line 256 of file Descriptor.h.
References ElemRecord, and IsArray.
Referenced by clang::interp::copyComposite(), clang::interp::copyRecord(), dump(), isUnion(), clang::interp::RunDestructors(), and clang::interp::runRecordDestructor().
bool Descriptor::isUnion | ( | ) | const |
Checks if the descriptor is of a union.
Definition at line 424 of file Descriptor.cpp.
References ElemRecord, isRecord(), and clang::interp::Record::isUnion().
Referenced by clang::interp::Pointer::activate(), and dump().
|
inline |
Checks if the descriptor is of an array of unknown size.
Definition at line 248 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 246 of file Descriptor.h.
Referenced by dump().
|
inline |
Make this descriptor a dummy descriptor.
Definition at line 192 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 160 of file Descriptor.h.
Referenced by clang::interp::Block::invokeCtor().
const BlockDtorFn clang::interp::Descriptor::DtorFn = nullptr |
Definition at line 161 of file Descriptor.h.
Referenced by clang::interp::Block::invokeDtor().
const Descriptor* const clang::interp::Descriptor::ElemDesc = nullptr |
Descriptor of the array element.
Definition at line 143 of file Descriptor.h.
Referenced by clang::interp::Pointer::getElemRecord(), isCompositeArray(), isPrimitiveArray(), and clang::interp::RunDestructors().
const Record* const clang::interp::Descriptor::ElemRecord = nullptr |
Pointer to the record, if block contains records.
Definition at line 141 of file Descriptor.h.
Referenced by clang::interp::IntPointer::atOffset(), clang::interp::collectBlocks(), clang::interp::copyRecord(), clang::interp::Pointer::getElemRecord(), clang::interp::Pointer::getRecord(), isPrimitive(), isRecord(), isUnion(), and clang::interp::runRecordDestructor().
|
staticconstexpr |
Definition at line 133 of file Descriptor.h.
Referenced by clang::interp::Program::createGlobalString().
|
staticconstexpr |
Definition at line 132 of file Descriptor.h.
Referenced by clang::interp::DynamicAllocator::allocate(), clang::interp::Compiler< Emitter >::allocateLocal(), clang::interp::Compiler< Emitter >::allocateLocalPrimitive(), clang::interp::Compiler< Emitter >::allocateTemporary(), clang::interp::Compiler< Emitter >::VisitCastExpr(), and clang::interp::Compiler< Emitter >::VisitCXXNewExpr().
Flag indicating if the block is an array.
Definition at line 155 of file Descriptor.h.
Referenced by clang::interp::Pointer::expand(), clang::interp::Pointer::hasSameArray(), clang::interp::Pointer::inArray(), isArray(), isCompositeArray(), isPrimitive(), isPrimitiveArray(), and isRecord().
Flag indicating if the block is mutable.
Definition at line 149 of file Descriptor.h.
Referenced by clang::interp::Block::invokeCtor(), and clang::interp::Pointer::isConst().
Flag indicating if this is a dummy descriptor.
Definition at line 157 of file Descriptor.h.
Referenced by isDummy(), and makeDummy().
Flag indicating if a field is mutable.
Definition at line 151 of file Descriptor.h.
Referenced by clang::interp::Block::invokeCtor().
Flag indicating if the block is a temporary.
Definition at line 153 of file Descriptor.h.
Referenced by clang::interp::Program::dump(), and clang::interp::Block::isTemporary().
|
staticconstexpr |
Maximum number of bytes to be used for array elements.
Definition at line 136 of file Descriptor.h.
Referenced by clang::interp::CheckArraySize(), and Descriptor().
const BlockMoveFn clang::interp::Descriptor::MoveFn = nullptr |
Definition at line 162 of file Descriptor.h.
Referenced by clang::interp::InterpState::deallocate().
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 147 of file Descriptor.h.
Referenced by getPrimType().