18 using namespace clang;
20 void ASTRecordLayout::Destroy(
ASTContext &Ctx) {
22 CXXInfo->~CXXRecordLayoutInfo();
34 : Size(size), DataSize(datasize), Alignment(alignment),
35 RequiredAlignment(requiredAlignment), CXXInfo(nullptr) {
36 FieldOffsets.append(Ctx, fieldoffsets.begin(), fieldoffsets.end());
40 ASTRecordLayout::ASTRecordLayout(
const ASTContext &Ctx,
43 bool hasOwnVFPtr,
bool hasExtendableVFPtr,
51 bool IsPrimaryBaseVirtual,
53 bool EndsWithZeroSizedObject,
54 bool LeadsWithZeroSizedBase,
55 const BaseOffsetsMapTy& BaseOffsets,
56 const VBaseOffsetsMapTy& VBaseOffsets)
57 : Size(size), DataSize(datasize), Alignment(alignment),
58 RequiredAlignment(requiredAlignment), CXXInfo(new (Ctx) CXXRecordLayoutInfo)
60 FieldOffsets.append(Ctx, fieldoffsets.begin(), fieldoffsets.end());
62 CXXInfo->PrimaryBase.setPointer(PrimaryBase);
63 CXXInfo->PrimaryBase.setInt(IsPrimaryBaseVirtual);
64 CXXInfo->NonVirtualSize = nonvirtualsize;
65 CXXInfo->NonVirtualAlignment = nonvirtualalignment;
66 CXXInfo->SizeOfLargestEmptySubobject = SizeOfLargestEmptySubobject;
67 CXXInfo->BaseOffsets = BaseOffsets;
68 CXXInfo->VBaseOffsets = VBaseOffsets;
69 CXXInfo->HasOwnVFPtr = hasOwnVFPtr;
70 CXXInfo->VBPtrOffset = vbptroffset;
71 CXXInfo->HasExtendableVFPtr = hasExtendableVFPtr;
72 CXXInfo->BaseSharingVBPtr = BaseSharingVBPtr;
73 CXXInfo->EndsWithZeroSizedObject = EndsWithZeroSizedObject;
74 CXXInfo->LeadsWithZeroSizedBase = LeadsWithZeroSizedBase;
79 if (isPrimaryBaseVirtual()) {
81 assert(getVBaseClassOffset(PrimaryBase).isZero() &&
82 "Primary virtual base must be at offset 0!");
85 assert(getBaseClassOffset(PrimaryBase).isZero() &&
86 "Primary base must be at offset 0!");
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void Deallocate(void *Ptr) const
bool hasPrimaryVBases() const
Does this ABI allow virtual bases to be primary base classes?
const TargetInfo & getTargetInfo() const
CharUnits - This is an opaque type for sizes expressed in character units.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Defines the clang::TargetInfo interface.