When possible, use the vbase offset offsets from the most derived class directly.

llvm-svn: 98247
This commit is contained in:
Anders Carlsson 2010-03-11 07:00:45 +00:00
parent 3521552ebe
commit e4424888e4
1 changed files with 10 additions and 3 deletions

View File

@ -1406,9 +1406,16 @@ VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
if (!Offset.isEmpty()) {
if (Offset.VirtualBase) {
// Get the virtual base offset offset.
Adjustment.VBaseOffsetOffset =
VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass,
Offset.VirtualBase);
if (Offset.DerivedClass == MostDerivedClass) {
// We can get the offset offset directly from our map.
Adjustment.VBaseOffsetOffset =
VBaseOffsetOffsets.lookup(Offset.VirtualBase);
} else {
Adjustment.VBaseOffsetOffset =
VtableInfo.getVirtualBaseOffsetIndex(Offset.DerivedClass,
Offset.VirtualBase);
}
// FIXME: Once the assert in getVirtualBaseOffsetIndex is back again,
// we can get rid of this assert.
assert(Adjustment.VBaseOffsetOffset != 0 &&