aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp20
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());