From 1750b4f1bd2544c3596239a68cd4645a0be02c56 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 3 Dec 2009 03:28:24 +0000 Subject: [PATCH] Revert r90402 for now, virt.cpp is failing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90406 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGVtable.cpp | 20 +++++++++----------- 1 file 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()->getResultType()->getPointeeType(); + MD->getType()->getAs()->getResultType(); - const CXXRecordDecl *BaseDecl = - cast(BaseType->getAs()->getDecl()); + int64_t NonVirtualAdjustment = + getNVOffset(Thunk.ReturnType, DerivedType) / 8; - const CXXRecordDecl *DerivedDecl = - cast(DerivedType->getAs()->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(cast(CanDerivedType)->getDecl()); + cast(cast(CanDerivedType)->getDecl()); const CXXRecordDecl *BaseDecl = cast(cast(CanBaseType)->getDecl()); -- 2.40.0