clang 23.0.0git
Descriptor.cpp
Go to the documentation of this file.
1//===--- Descriptor.cpp - Types for the constexpr VM ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "Descriptor.h"
10#include "Boolean.h"
11#include "FixedPoint.h"
12#include "Floating.h"
13#include "IntegralAP.h"
14#include "MemberPointer.h"
15#include "Pointer.h"
16#include "PrimType.h"
17#include "Record.h"
18#include "Source.h"
19#include "clang/AST/ExprCXX.h"
20
21using namespace clang;
22using namespace clang::interp;
23
24template <typename T> static constexpr bool needsCtor() {
25 if constexpr (std::is_same_v<T, Integral<8, true>> ||
26 std::is_same_v<T, Integral<8, false>> ||
27 std::is_same_v<T, Integral<16, true>> ||
28 std::is_same_v<T, Integral<16, false>> ||
29 std::is_same_v<T, Integral<32, true>> ||
30 std::is_same_v<T, Integral<32, false>> ||
31 std::is_same_v<T, Integral<64, true>> ||
32 std::is_same_v<T, Integral<64, false>> ||
33 std::is_same_v<T, Boolean>)
34 return false;
35
36 return true;
37}
38
39template <typename T>
40static void ctorTy(Block *, std::byte *Ptr, bool, bool, bool, bool, bool,
41 const Descriptor *) {
42 static_assert(needsCtor<T>());
43 new (Ptr) T();
44}
45
46template <typename T>
47static void dtorTy(Block *, std::byte *Ptr, const Descriptor *) {
48 static_assert(needsCtor<T>());
49 reinterpret_cast<T *>(Ptr)->~T();
50}
51
52template <typename T>
53static void ctorArrayTy(Block *, std::byte *Ptr, bool, bool, bool, bool, bool,
54 const Descriptor *D) {
55 new (Ptr) InitMapPtr();
56
57 if constexpr (needsCtor<T>()) {
58 Ptr += sizeof(InitMapPtr);
59 for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
60 new (&reinterpret_cast<T *>(Ptr)[I]) T();
61 }
62 }
63}
64
65template <typename T>
66static void dtorArrayTy(Block *, std::byte *Ptr, const Descriptor *D) {
67 InitMapPtr &IMP = *reinterpret_cast<InitMapPtr *>(Ptr);
68 IMP.deleteInitMap();
69
70 if constexpr (needsCtor<T>()) {
71 Ptr += sizeof(InitMapPtr);
72 for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
73 reinterpret_cast<T *>(Ptr)[I].~T();
74 }
75 }
76}
77
78static void ctorArrayDesc(Block *B, std::byte *Ptr, bool IsConst,
79 bool IsMutable, bool IsVolatile, bool IsActive,
80 bool InUnion, const Descriptor *D) {
81 const unsigned NumElems = D->getNumElems();
82 const unsigned ElemSize =
84
85 unsigned ElemOffset = 0;
86 for (unsigned I = 0; I != NumElems; ++I, ElemOffset += ElemSize) {
87 auto *ElemPtr = Ptr + ElemOffset;
88 auto *Desc = reinterpret_cast<InlineDescriptor *>(ElemPtr);
89 auto *SD = D->ElemDesc;
90
91 Desc->Offset = ElemOffset + sizeof(InlineDescriptor);
92 Desc->Desc = SD;
93 Desc->IsInitialized = true;
94 Desc->IsBase = false;
95 Desc->IsActive = IsActive;
96 Desc->IsConst = IsConst || D->IsConst;
97 Desc->IsFieldMutable = IsMutable || D->IsMutable;
98 Desc->InUnion = InUnion;
99 Desc->IsArrayElement = true;
100 Desc->IsVolatile = IsVolatile;
101
102 if (auto Fn = D->ElemDesc->CtorFn) {
103 auto *ElemLoc = reinterpret_cast<std::byte *>(Desc + 1);
104 Fn(B, ElemLoc, Desc->IsConst, Desc->IsFieldMutable, IsVolatile, IsActive,
105 Desc->InUnion || SD->isUnion(), D->ElemDesc);
106 }
107 }
108}
109
110static void dtorArrayDesc(Block *B, std::byte *Ptr, const Descriptor *D) {
111 const unsigned NumElems = D->getNumElems();
112 const unsigned ElemSize =
113 D->ElemDesc->getAllocSize() + sizeof(InlineDescriptor);
114
115 unsigned ElemOffset = 0;
116 auto Dtor = D->ElemDesc->DtorFn;
117 assert(Dtor &&
118 "a composite array without an elem dtor shouldn't have a dtor itself");
119 for (unsigned I = 0; I != NumElems; ++I, ElemOffset += ElemSize) {
120 auto *ElemPtr = Ptr + ElemOffset;
121 auto *Desc = reinterpret_cast<InlineDescriptor *>(ElemPtr);
122 auto *ElemLoc = reinterpret_cast<std::byte *>(Desc + 1);
123 Dtor(B, ElemLoc, D->ElemDesc);
124 }
125}
126
127static void initField(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable,
128 bool IsVolatile, bool IsActive, bool IsUnionField,
129 bool InUnion, const Descriptor *D, unsigned FieldOffset) {
130 auto *Desc = reinterpret_cast<InlineDescriptor *>(Ptr + FieldOffset) - 1;
131 Desc->Offset = FieldOffset;
132 Desc->Desc = D;
133 Desc->IsInitialized = D->IsArray;
134 Desc->IsBase = false;
135 Desc->IsActive = IsActive && !IsUnionField;
136 Desc->InUnion = InUnion;
137 Desc->IsConst = IsConst || D->IsConst;
138 Desc->IsFieldMutable = IsMutable || D->IsMutable;
139 Desc->IsVolatile = IsVolatile || D->IsVolatile;
140 // True if this field is const AND the parent is mutable.
141 Desc->IsConstInMutable = Desc->IsConst && IsMutable;
142
143 if (auto Fn = D->CtorFn)
144 Fn(B, Ptr + FieldOffset, Desc->IsConst, Desc->IsFieldMutable,
145 Desc->IsVolatile, Desc->IsActive, InUnion || D->isUnion(), D);
146}
147
148static void initBase(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable,
149 bool IsVolatile, bool IsActive, bool InUnion,
150 const Descriptor *D, unsigned FieldOffset,
151 bool IsVirtualBase) {
152 assert(D);
153 assert(D->ElemRecord);
154 assert(!D->ElemRecord->isUnion()); // Unions cannot be base classes.
155
156 auto *Desc = reinterpret_cast<InlineDescriptor *>(Ptr + FieldOffset) - 1;
157 Desc->Offset = FieldOffset;
158 Desc->Desc = D;
159 Desc->IsInitialized = D->IsArray;
160 Desc->IsBase = true;
161 Desc->IsVirtualBase = IsVirtualBase;
162 Desc->IsActive = IsActive && !InUnion;
163 Desc->IsConst = IsConst || D->IsConst;
164 Desc->IsFieldMutable = IsMutable || D->IsMutable;
165 Desc->InUnion = InUnion;
166 Desc->IsVolatile = false;
167
168 for (const auto &V : D->ElemRecord->bases())
169 initBase(B, Ptr + FieldOffset, IsConst, IsMutable, IsVolatile, IsActive,
170 InUnion, V.Desc, V.Offset, false);
171 for (const auto &F : D->ElemRecord->fields())
172 initField(B, Ptr + FieldOffset, IsConst, IsMutable, IsVolatile, IsActive,
173 InUnion, InUnion, F.Desc, F.Offset);
174}
175
176static void ctorRecord(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable,
177 bool IsVolatile, bool IsActive, bool InUnion,
178 const Descriptor *D) {
179 for (const auto &V : D->ElemRecord->bases())
180 initBase(B, Ptr, IsConst, IsMutable, IsVolatile, IsActive, InUnion, V.Desc,
181 V.Offset,
182 /*IsVirtualBase=*/false);
183 for (const auto &F : D->ElemRecord->fields()) {
184 bool IsUnionField = D->isUnion();
185 initField(B, Ptr, IsConst, IsMutable, IsVolatile, IsActive, IsUnionField,
186 InUnion || IsUnionField, F.Desc, F.Offset);
187 }
188 for (const auto &V : D->ElemRecord->virtual_bases())
189 initBase(B, Ptr, IsConst, IsMutable, IsVolatile, IsActive, InUnion, V.Desc,
190 V.Offset,
191 /*IsVirtualBase=*/true);
192}
193
194static void destroyField(Block *B, std::byte *Ptr, const Descriptor *D,
195 unsigned FieldOffset) {
196 if (auto Fn = D->DtorFn)
197 Fn(B, Ptr + FieldOffset, D);
198}
199
200static void destroyBase(Block *B, std::byte *Ptr, const Descriptor *D,
201 unsigned FieldOffset) {
202 assert(D);
203 assert(D->ElemRecord);
204
205 for (const auto &V : D->ElemRecord->bases())
206 destroyBase(B, Ptr + FieldOffset, V.Desc, V.Offset);
207 for (const auto &F : D->ElemRecord->fields())
208 destroyField(B, Ptr + FieldOffset, F.Desc, F.Offset);
209}
210
211static void dtorRecord(Block *B, std::byte *Ptr, const Descriptor *D) {
212 for (const auto &F : D->ElemRecord->bases())
213 destroyBase(B, Ptr, F.Desc, F.Offset);
214 for (const auto &F : D->ElemRecord->fields())
215 destroyField(B, Ptr, F.Desc, F.Offset);
216 for (const auto &F : D->ElemRecord->virtual_bases())
217 destroyBase(B, Ptr, F.Desc, F.Offset);
218}
219
220/// Whether a record needs its descriptor dtor function called.
221static bool needsRecordDtor(const Record *R) {
222 for (const auto &B : R->bases()) {
223 if (B.Desc->DtorFn)
224 return true;
225 }
226
227 for (const auto &F : R->fields()) {
228 if (F.Desc->DtorFn)
229 return true;
230 }
231
232 for (const auto &V : R->virtual_bases()) {
233 if (V.Desc->DtorFn)
234 return true;
235 }
236 return false;
237}
238
240 switch (T) {
241 case PT_Float:
243 case PT_IntAP:
245 case PT_IntAPS:
247 case PT_Ptr:
249 case PT_MemberPtr:
251 default:
252 return nullptr;
253 }
254 llvm_unreachable("Unhandled PrimType");
255}
256
258 switch (T) {
259 case PT_Float:
261 case PT_IntAP:
263 case PT_IntAPS:
265 case PT_Ptr:
267 case PT_MemberPtr:
269 default:
270 return nullptr;
271 }
272 llvm_unreachable("Unhandled PrimType");
273}
274
277 llvm_unreachable("unknown Expr");
278}
279
282 llvm_unreachable("unknown Expr");
283}
284
285/// Primitives.
286Descriptor::Descriptor(const DeclTy &D, const Type *SourceTy, PrimType Type,
287 MetadataSize MD, bool IsConst, bool IsTemporary,
288 bool IsMutable, bool IsVolatile)
289 : Source(D), SourceType(SourceTy), ElemSize(primSize(Type)), Size(ElemSize),
290 MDSize(MD.value_or(0)), AllocSize(align(Size + MDSize)), PrimT(Type),
294 assert(AllocSize >= Size);
295 assert(Source && "Missing source");
296}
297
298/// Primitive arrays.
300 size_t NumElems, bool IsConst, bool IsTemporary,
301 bool IsMutable)
302 : Source(D), ElemSize(primSize(Type)), Size(ElemSize * NumElems),
303 MDSize(MD.value_or(0)),
304 AllocSize(align(MDSize) + align(Size) + sizeof(InitMapPtr)), PrimT(Type),
308 assert(Source && "Missing source");
309 assert(NumElems <= (MaxArrayElemBytes / ElemSize));
310}
311
312/// Primitive unknown-size arrays.
314 bool IsTemporary, bool IsConst, UnknownSize)
315 : Source(D), ElemSize(primSize(Type)), Size(UnknownSizeMark),
316 MDSize(MD.value_or(0)),
317 AllocSize(MDSize + sizeof(InitMapPtr) + alignof(void *)), PrimT(Type),
321 assert(Source && "Missing source");
322}
323
324/// Arrays of composite elements.
325Descriptor::Descriptor(const DeclTy &D, const Type *SourceTy,
326 const Descriptor *Elem, MetadataSize MD,
327 unsigned NumElems, bool IsConst, bool IsTemporary,
328 bool IsMutable)
329 : Source(D), SourceType(SourceTy),
330 ElemSize(Elem->getAllocSize() + sizeof(InlineDescriptor)),
331 Size(ElemSize * NumElems), MDSize(MD.value_or(0)),
332 AllocSize(std::max<size_t>(alignof(void *), Size) + MDSize),
336 assert(Source && "Missing source");
337}
338
339/// Unknown-size arrays of composite elements.
342 : Source(D), ElemSize(Elem->getAllocSize() + sizeof(InlineDescriptor)),
343 Size(UnknownSizeMark), MDSize(MD.value_or(0)),
344 AllocSize(MDSize + alignof(void *)), ElemDesc(Elem), IsConst(true),
347 assert(Source && "Missing source");
348}
349
350/// Composite records.
352 bool IsConst, bool IsTemporary, bool IsMutable,
353 bool IsVolatile)
354 : Source(D), ElemSize(std::max<size_t>(alignof(void *), R->getFullSize())),
355 Size(ElemSize), MDSize(MD.value_or(0)), AllocSize(Size + MDSize),
359 assert(Source && "Missing source");
360}
361
362/// Dummy.
364 : Source(D), ElemSize(1), Size(1), MDSize(MD.value_or(0)),
365 AllocSize(MDSize), ElemRecord(nullptr), IsConst(true), IsMutable(false),
367 assert(Source && "Missing source");
368}
369
371 if (SourceType)
372 return QualType(SourceType, 0);
373 if (const auto *D = asValueDecl())
374 return D->getType();
375 if (const auto *T = dyn_cast_if_present<TypeDecl>(asDecl()))
376 return T->getASTContext().getTypeDeclType(T);
377
378 // The Source sometimes has a different type than the once
379 // we really save. Try to consult the Record first.
380 if (isRecord()) {
381 const RecordDecl *RD = ElemRecord->getDecl();
382 return RD->getASTContext().getCanonicalTagType(RD);
383 }
384 if (const auto *E = asExpr())
385 return E->getType();
386 llvm_unreachable("Invalid descriptor type");
387}
388
390 assert(isArray());
391 QualType T = getType();
392 if (const auto *AT = T->getAs<AtomicType>())
393 T = AT->getValueType();
394 if (T->isPointerOrReferenceType())
395 T = T->getPointeeType();
396
397 if (const auto *AT = T->getAsArrayTypeUnsafe()) {
398 // For primitive arrays, we don't save a QualType at all,
399 // just a PrimType. Try to figure out the QualType here.
400 if (isPrimitiveArray()) {
401 while (T->isArrayType())
402 T = T->getAsArrayTypeUnsafe()->getElementType();
403 return T;
404 }
405 return AT->getElementType();
406 }
407 if (const auto *CT = T->getAs<ComplexType>())
408 return CT->getElementType();
409 if (const auto *CT = T->getAs<VectorType>())
410 return CT->getElementType();
411
412 return T;
413}
414
416 auto MakeArrayType = [&](QualType ElemType) -> QualType {
417 if (IsArray)
418 return Ctx.getConstantArrayType(
419 ElemType, APInt(64, static_cast<uint64_t>(getNumElems()), false),
420 nullptr, ArraySizeModifier::Normal, 0);
421 return ElemType;
422 };
423
424 if (const auto *E = asExpr()) {
425 if (isa<CXXNewExpr>(E))
426 return MakeArrayType(E->getType()->getPointeeType());
427
428 // std::allocator.allocate() call.
429 if (const auto *ME = dyn_cast<CXXMemberCallExpr>(E);
430 ME && ME->getRecordDecl()->getName() == "allocator" &&
431 ME->getMethodDecl()->getName() == "allocate")
432 return MakeArrayType(E->getType()->getPointeeType());
433 return E->getType();
434 }
435
436 return getType();
437}
438
440 if (const auto *E = asExpr()) {
441 if (isa<CXXNewExpr>(E))
442 return E->getType()->getPointeeType();
443
444 // std::allocator.allocate() call.
445 if (const auto *ME = dyn_cast<CXXMemberCallExpr>(E);
446 ME && ME->getRecordDecl()->getName() == "allocator" &&
447 ME->getMethodDecl()->getName() == "allocate")
448 return E->getType()->getPointeeType();
449 return E->getType();
450 }
451
452 return getType();
453}
454
456 if (auto *D = dyn_cast<const Decl *>(Source))
457 return D->getLocation();
458 if (auto *E = dyn_cast<const Expr *>(Source))
459 return E->getExprLoc();
460 llvm_unreachable("Invalid descriptor type");
461}
462
464 if (const auto *D = dyn_cast<const Decl *>(Source))
465 return SourceInfo(D);
466 if (const auto *E = dyn_cast<const Expr *>(Source))
467 return SourceInfo(E);
468 llvm_unreachable("Invalid descriptor type");
469}
470
472 if (isPrimitive() || isPrimitiveArray())
473 return true;
474
475 if (isRecord()) {
476 assert(ElemRecord);
477 return ElemRecord->hasTrivialDtor();
478 }
479
480 if (!ElemDesc)
481 return true;
482 // Composite arrays.
483 return ElemDesc->hasTrivialDtor();
484}
485
486bool Descriptor::isUnion() const { return isRecord() && ElemRecord->isUnion(); }
#define V(N, I)
static void ctorRecord(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable, bool IsVolatile, bool IsActive, bool InUnion, const Descriptor *D)
static void dtorTy(Block *, std::byte *Ptr, const Descriptor *)
static BlockCtorFn getCtorArrayPrim(PrimType Type)
static void destroyField(Block *B, std::byte *Ptr, const Descriptor *D, unsigned FieldOffset)
static void initField(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable, bool IsVolatile, bool IsActive, bool IsUnionField, bool InUnion, const Descriptor *D, unsigned FieldOffset)
static void dtorArrayTy(Block *, std::byte *Ptr, const Descriptor *D)
static void ctorTy(Block *, std::byte *Ptr, bool, bool, bool, bool, bool, const Descriptor *)
static void ctorArrayDesc(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable, bool IsVolatile, bool IsActive, bool InUnion, const Descriptor *D)
static void destroyBase(Block *B, std::byte *Ptr, const Descriptor *D, unsigned FieldOffset)
static constexpr bool needsCtor()
static void dtorArrayDesc(Block *B, std::byte *Ptr, const Descriptor *D)
static BlockCtorFn getCtorPrim(PrimType T)
static bool needsRecordDtor(const Record *R)
Whether a record needs its descriptor dtor function called.
static BlockDtorFn getDtorArrayPrim(PrimType Type)
static void ctorArrayTy(Block *, std::byte *Ptr, bool, bool, bool, bool, bool, const Descriptor *D)
static BlockDtorFn getDtorPrim(PrimType T)
static void dtorRecord(Block *B, std::byte *Ptr, const Descriptor *D)
static void initBase(Block *B, std::byte *Ptr, bool IsConst, bool IsMutable, bool IsVolatile, bool IsActive, bool InUnion, const Descriptor *D, unsigned FieldOffset, bool IsVirtualBase)
Defines the clang::Expr interface and subclasses for C++ expressions.
#define TYPE_SWITCH(Expr, B)
Definition PrimType.h:213
__DEVICE__ int max(int __a, int __b)
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:226
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
CanQualType getCanonicalTagType(const TagDecl *TD) const
Complex values, per C99 6.2.5p11.
Definition TypeBase.h:3325
ASTContext & getASTContext() const LLVM_READONLY
Definition DeclBase.cpp:546
A (possibly-)qualified type.
Definition TypeBase.h:937
Represents a struct/union/class.
Definition Decl.h:4342
Encodes a location in the source.
The base class of the type hierarchy.
Definition TypeBase.h:1866
Represents a GCC generic vector type.
Definition TypeBase.h:4225
A memory block, either on the stack or in the heap.
Definition InterpBlock.h:44
Structure/Class descriptor.
Definition Record.h:25
bool isUnion() const
Checks if the record is a union.
Definition Record.h:69
llvm::iterator_range< const_virtual_iter > virtual_bases() const
Definition Record.h:117
llvm::iterator_range< const_base_iter > bases() const
Definition Record.h:102
llvm::iterator_range< const_field_iter > fields() const
Definition Record.h:90
Describes the statement/declaration an opcode was generated from.
Definition Source.h:74
void(*)(Block *Storage, std::byte *FieldPtr, const Descriptor *FieldDesc) BlockDtorFn
Invoked when a block is destroyed.
Definition Descriptor.h:40
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
Definition Descriptor.h:29
bool NE(InterpState &S, CodePtr OpPC)
Definition Interp.h:1327
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
Definition PrimType.h:191
llvm::APInt APInt
Definition FixedPoint.h:19
PrimType
Enumeration of the primitive types of the VM.
Definition PrimType.h:33
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
Definition PrimType.cpp:23
void(*)(Block *Storage, std::byte *FieldPtr, bool IsConst, bool IsMutable, bool IsVolatile, bool IsActive, bool InUnion, const Descriptor *FieldDesc) BlockCtorFn
Invoked whenever a block is created.
Definition Descriptor.h:34
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
#define false
Definition stdbool.h:26
#define true
Definition stdbool.h:25
Token to denote structures of unknown size.
Definition Descriptor.h:140
Describes a memory block created by an allocation site.
Definition Descriptor.h:121
const bool IsConst
Flag indicating if the block is mutable.
Definition Descriptor.h:160
unsigned getAllocSize() const
Returns the allocated size, including metadata.
Definition Descriptor.h:246
unsigned getNumElems() const
Returns the number of elements stored in the block.
Definition Descriptor.h:253
bool isPrimitive() const
Checks if the descriptor is of a primitive.
Definition Descriptor.h:267
QualType getElemQualType() const
bool hasTrivialDtor() const
Whether variables of this descriptor need their destructor called or not.
const BlockDtorFn DtorFn
Definition Descriptor.h:172
const OptPrimType PrimT
The primitive type this descriptor was created for, or the primitive element type in case this is a p...
Definition Descriptor.h:158
const ValueDecl * asValueDecl() const
Definition Descriptor.h:214
const BlockCtorFn CtorFn
Storage management methods.
Definition Descriptor.h:171
static constexpr unsigned MaxArrayElemBytes
Maximum number of bytes to be used for array elements.
Definition Descriptor.h:147
QualType getType() const
const Decl * asDecl() const
Definition Descriptor.h:210
const Descriptor *const ElemDesc
Descriptor of the array element.
Definition Descriptor.h:154
SourceInfo getLoc() const
Descriptor(const DeclTy &D, const Type *SourceTy, PrimType Type, MetadataSize MD, bool IsConst, bool IsTemporary, bool IsMutable, bool IsVolatile)
Allocates a descriptor for a primitive.
SourceLocation getLocation() const
const bool IsMutable
Flag indicating if a field is mutable.
Definition Descriptor.h:162
QualType getDataType(const ASTContext &Ctx) const
std::optional< unsigned > MetadataSize
Definition Descriptor.h:142
const bool IsArray
Flag indicating if the block is an array.
Definition Descriptor.h:167
bool isPrimitiveArray() const
Checks if the descriptor is of an array of primitives.
Definition Descriptor.h:258
QualType getDataElemType() const
bool isRecord() const
Checks if the descriptor is of a record.
Definition Descriptor.h:272
const bool IsTemporary
Flag indicating if the block is a temporary.
Definition Descriptor.h:164
const Record *const ElemRecord
Pointer to the record, if block contains records.
Definition Descriptor.h:152
bool isUnion() const
Checks if the descriptor is of a union.
const Expr * asExpr() const
Definition Descriptor.h:211
bool isArray() const
Checks if the descriptor is of an array.
Definition Descriptor.h:270
A pointer-sized struct we use to allocate into data storage.
Definition InitMap.h:79
void deleteInitMap()
Delete the InitMap if one exists.
Definition InitMap.h:113
Inline descriptor embedded in structures and arrays.
Definition Descriptor.h:66
unsigned Offset
Offset inside the structure/array.
Definition Descriptor.h:68