diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-03 03:15:31 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-03 03:15:31 +0000 |
commit | b5b32f5292a8c4e1be8fd5c2865ce48767ec63d5 (patch) | |
tree | 1d3f79bf4ff908ea228546cf156edd4bf475f2f5 /lib/CodeGen/CGVtable.cpp | |
parent | 9fcfc421d3bf124beed5b185b8d6d795edcbf83a (diff) |
Use Eli's ComputeThunkAdjustment for calculating the return adjustment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 007960e998..caac827016 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -274,18 +274,20 @@ public: Thunks.erase(i); } - - // Construct the return adjustment. + + QualType BaseType = QualType(Thunk.ReturnType)->getPointeeType(); QualType DerivedType = - MD->getType()->getAs<FunctionType>()->getResultType(); + MD->getType()->getAs<FunctionType>()->getResultType()->getPointeeType(); - int64_t NonVirtualAdjustment = - getNVOffset(Thunk.ReturnType, DerivedType) / 8; + const CXXRecordDecl *BaseDecl = + cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl()); - int64_t VirtualAdjustment = - getVbaseOffset(Thunk.ReturnType, DerivedType); + const CXXRecordDecl *DerivedDecl = + cast<CXXRecordDecl>(DerivedType->getAs<RecordType>()->getDecl()); - ThunkAdjustment ReturnAdjustment(NonVirtualAdjustment, VirtualAdjustment); + // Construct the return adjustment. + 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()); |