]> granicus.if.org Git - clang/commitdiff
Refine the non-virtual this adjustments for thunks by using the offset
authorMike Stump <mrs@apple.com>
Tue, 26 Jan 2010 22:44:01 +0000 (22:44 +0000)
committerMike Stump <mrs@apple.com>
Tue, 26 Jan 2010 22:44:01 +0000 (22:44 +0000)
to the declaring class from the nearest virtual base class.  WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94606 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVtable.cpp

index cb3f1816d8a224297a02065e77aa804aec5643f6..b6bb385fe946034a0a77a5db5dfe3d59c5a54c80 100644 (file)
@@ -1114,6 +1114,12 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, bool MorallyVirtual,
                   (int)VCalls[idx-1], MostDerivedClass->getNameAsCString()));
       }
       int64_t NonVirtualAdjustment = -VCallOffset[OGD];
+      QualType DerivedType = MD->getThisType(CGM.getContext());
+      QualType BaseType = cast<const CXXMethodDecl>(OGD.getDecl())->getThisType(CGM.getContext());
+      int64_t NonVirtualAdjustment2 = -(getNVOffset(BaseType, DerivedType)/8);
+      if (NonVirtualAdjustment2 != NonVirtualAdjustment) {
+        NonVirtualAdjustment = NonVirtualAdjustment2;
+      }
       int64_t VirtualAdjustment = 
         -((idx + extra + 2) * LLVMPointerWidth / 8);