/// MostDerivedClassOffset - If we're building a construction vtable, this
/// holds the offset from the layout class to the most derived class.
- const uint64_t MostDerivedClassOffset;
+ const CharUnits MostDerivedClassOffset;
/// MostDerivedClassIsVirtual - Whether the most derived class is a virtual
/// base. (This only makes sense when building a construction vtable).
public:
VTableBuilder(CodeGenVTables &VTables, const CXXRecordDecl *MostDerivedClass,
- uint64_t MostDerivedClassOffset, bool MostDerivedClassIsVirtual,
- const CXXRecordDecl *LayoutClass)
+ CharUnits MostDerivedClassOffset,
+ bool MostDerivedClassIsVirtual, const
+ CXXRecordDecl *LayoutClass)
: VTables(VTables), MostDerivedClass(MostDerivedClass),
MostDerivedClassOffset(MostDerivedClassOffset),
MostDerivedClassIsVirtual(MostDerivedClassIsVirtual),
LayoutClass(LayoutClass), Context(MostDerivedClass->getASTContext()),
- Overriders(MostDerivedClass,
- MostDerivedClass->getASTContext().toCharUnitsFromBits(
- MostDerivedClassOffset),
- LayoutClass) {
+ Overriders(MostDerivedClass, MostDerivedClassOffset, LayoutClass) {
LayoutVTable();
}
CharUnits::Zero()),
/*BaseIsMorallyVirtual=*/false,
MostDerivedClassIsVirtual,
- MostDerivedClassOffset);
+ Context.toBits(MostDerivedClassOffset));
VisitedVirtualBasesSetTy VBases;
// Determine the primary virtual bases.
- DeterminePrimaryVirtualBases(MostDerivedClass, MostDerivedClassOffset,
- VBases);
+ DeterminePrimaryVirtualBases(MostDerivedClass,
+ Context.toBits(MostDerivedClassOffset), VBases);
VBases.clear();
LayoutVTablesForVirtualBases(MostDerivedClass, VBases);
// Add the offset to top.
// FIXME: We should not use / 8 here.
int64_t OffsetToTop = -(int64_t)(OffsetInLayoutClass -
- MostDerivedClassOffset) / 8;
+ Context.toBits(MostDerivedClassOffset)) / 8;
Components.push_back(VTableComponent::MakeOffsetToTop(OffsetToTop));
// Next, add the RTTI.
if (isBuildingConstructorVTable()) {
Out << "Construction vtable for ('";
Out << MostDerivedClass->getQualifiedNameAsString() << "', ";
- // FIXME: Don't use / 8 .
- Out << MostDerivedClassOffset / 8 << ") in '";
+ Out << MostDerivedClassOffset.getQuantity() << ") in '";
Out << LayoutClass->getQualifiedNameAsString();
} else {
Out << "Vtable for '";
if (Entry.getPointer())
return;
- VTableBuilder Builder(*this, RD, 0, /*MostDerivedClassIsVirtual=*/0, RD);
+ VTableBuilder Builder(*this, RD, CharUnits::Zero(),
+ /*MostDerivedClassIsVirtual=*/0, RD);
// Add the VTable layout.
uint64_t NumVTableComponents = Builder.getNumVTableComponents();
const CXXRecordDecl *RD) {
// Dump the vtable layout if necessary.
if (CGM.getLangOptions().DumpVTableLayouts) {
- VTableBuilder Builder(*this, RD, 0, /*MostDerivedClassIsVirtual=*/0, RD);
+ VTableBuilder Builder(*this, RD, CharUnits::Zero(),
+ /*MostDerivedClassIsVirtual=*/0, RD);
Builder.dumpLayout(llvm::errs());
}
llvm::GlobalVariable::LinkageTypes Linkage,
VTableAddressPointsMapTy& AddressPoints) {
VTableBuilder Builder(*this, Base.getBase(),
- CGM.getContext().toBits(Base.getBaseOffset()),
+ Base.getBaseOffset(),
/*MostDerivedClassIsVirtual=*/BaseIsVirtual, RD);
// Dump the vtable layout if necessary.