28#define DUMP_OVERRIDERS 0
32 bool GenerateDefinition)
33 : Ctx(Ctx), MostDerivedClass(MostDerivedClass),
34 MostDerivedClassLayout(Ctx.getASTRecordLayout(MostDerivedClass)),
35 GenerateDefinition(GenerateDefinition) {
44 if (VTableClass == MostDerivedClass) {
45 assert(!SecondaryVirtualPointerIndices.count(
Base) &&
46 "A virtual pointer index already exists for this base subobject!");
47 SecondaryVirtualPointerIndices[
Base] = VTTComponents.size();
50 if (!GenerateDefinition) {
61 for (
const auto &I : RD->
bases()) {
66 const auto *BaseDecl =
80 bool BaseIsMorallyVirtual,
83 VisitedVirtualBasesSetTy &VBases) {
91 for (
const auto &I : RD->
bases()) {
92 const auto *BaseDecl =
102 if (!BaseDecl->isDynamicClass())
105 bool BaseDeclIsMorallyVirtual = BaseIsMorallyVirtual;
106 bool BaseDeclIsNonVirtualPrimaryBase =
false;
110 if (!VBases.insert(BaseDecl).second)
114 BaseDeclIsMorallyVirtual =
true;
118 BaseOffset =
Base.getBaseOffset() +
123 BaseDeclIsNonVirtualPrimaryBase =
true;
131 if (!BaseDeclIsNonVirtualPrimaryBase &&
132 (BaseDecl->getNumVBases() || BaseDeclIsMorallyVirtual)) {
134 AddVTablePointer(
BaseSubobject(BaseDecl, BaseOffset), VTableIndex,
139 LayoutSecondaryVirtualPointers(
BaseSubobject(BaseDecl, BaseOffset),
140 BaseDeclIsMorallyVirtual, VTableIndex,
141 VTableClass, VBases);
147 uint64_t VTableIndex) {
148 VisitedVirtualBasesSetTy VBases;
149 LayoutSecondaryVirtualPointers(
Base,
false,
150 VTableIndex,
Base.getBase(), VBases);
154 VisitedVirtualBasesSetTy &VBases) {
155 for (
const auto &I : RD->
bases()) {
156 const auto *BaseDecl =
162 if (!VBases.insert(BaseDecl).second)
173 if (BaseDecl->getNumVBases())
174 LayoutVirtualVTTs(BaseDecl, VBases);
187 bool IsPrimaryVTT =
Base.getBase() == MostDerivedClass;
191 SubVTTIndices[
Base] = VTTComponents.size();
194 uint64_t VTableIndex = VTTVTables.size();
198 AddVTablePointer(
Base, VTableIndex, RD);
201 LayoutSecondaryVTTs(
Base);
204 LayoutSecondaryVirtualPointers(
Base, VTableIndex);
208 VisitedVirtualBasesSetTy VBases;
209 LayoutVirtualVTTs(
Base.getBase(), VBases);
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
const CXXRecordDecl * getPrimaryBase() const
getPrimaryBase - Get the primary base for this record.
bool isPrimaryBaseVirtual() const
isPrimaryBaseVirtual - Get whether the primary base for this record is virtual or not.
Represents a C++ struct/union/class.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
CharUnits - This is an opaque type for sizes expressed in character units.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
VTTBuilder(ASTContext &Ctx, const CXXRecordDecl *MostDerivedClass, bool GenerateDefinition)
The JSON file list parser is used to communicate input to InstallAPI.