mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 08:57:43 +08:00
Use Eli's ComputeThunkAdjustment for calculating the return adjustment.
llvm-svn: 90402
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user