diff options
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index caac827016..007960e998 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -274,20 +274,18 @@ public: Thunks.erase(i); } - - QualType BaseType = QualType(Thunk.ReturnType)->getPointeeType(); + + // Construct the return adjustment. QualType DerivedType = - MD->getType()->getAs<FunctionType>()->getResultType()->getPointeeType(); + MD->getType()->getAs<FunctionType>()->getResultType(); - const CXXRecordDecl *BaseDecl = - cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl()); + int64_t NonVirtualAdjustment = + getNVOffset(Thunk.ReturnType, DerivedType) / 8; - const CXXRecordDecl *DerivedDecl = - cast<CXXRecordDecl>(DerivedType->getAs<RecordType>()->getDecl()); + int64_t VirtualAdjustment = + getVbaseOffset(Thunk.ReturnType, DerivedType); - // Construct the return adjustment. - ThunkAdjustment ReturnAdjustment = - CGM.ComputeThunkAdjustment(DerivedDecl, BaseDecl); + ThunkAdjustment ReturnAdjustment(NonVirtualAdjustment, VirtualAdjustment); CovariantThunkAdjustment Adjustment(ThisAdjustment, ReturnAdjustment); submethods[Index] = CGM.BuildCovariantThunk(MD, Extern, Adjustment); @@ -747,7 +745,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()); |