Use Eli's ComputeThunkAdjustment for calculating the return adjustment.

llvm-svn: 90402
This commit is contained in:
Anders Carlsson
2009-12-03 03:15:31 +00:00
parent 5f91fd64b6
commit e692f7c309

View File

@@ -274,18 +274,20 @@ public:
Thunks.erase(i);
}
QualType BaseType = QualType(Thunk.ReturnType)->getPointeeType();
QualType DerivedType =
MD->getType()->getAs<FunctionType>()->getResultType()->getPointeeType();
const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
const CXXRecordDecl *DerivedDecl =
cast<CXXRecordDecl>(DerivedType->getAs<RecordType>()->getDecl());
// Construct the return adjustment.
QualType DerivedType =
MD->getType()->getAs<FunctionType>()->getResultType();
int64_t NonVirtualAdjustment =
getNVOffset(Thunk.ReturnType, DerivedType) / 8;
int64_t VirtualAdjustment =
getVbaseOffset(Thunk.ReturnType, DerivedType);
ThunkAdjustment ReturnAdjustment(NonVirtualAdjustment, VirtualAdjustment);
ThunkAdjustment ReturnAdjustment =
CGM.ComputeThunkAdjustment(DerivedDecl, BaseDecl);
CovariantThunkAdjustment Adjustment(ThisAdjustment, ReturnAdjustment);
submethods[Index] = CGM.BuildCovariantThunk(MD, Extern, Adjustment);
@@ -745,7 +747,7 @@ TypeConversionRequiresAdjustment(ASTContext &Ctx,
}
const CXXRecordDecl *DerivedDecl =
cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(cast<RecordType>(CanBaseType)->getDecl());