[cfe-commits] r94606 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Mike Stump mrs at apple.com
Tue Jan 26 14:44:01 PST 2010


Author: mrs
Date: Tue Jan 26 16:44:01 2010
New Revision: 94606

URL: http://llvm.org/viewvc/llvm-project?rev=94606&view=rev
Log:
Refine the non-virtual this adjustments for thunks by using the offset
to the declaring class from the nearest virtual base class.  WIP.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=94606&r1=94605&r2=94606&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Tue Jan 26 16:44:01 2010
@@ -1114,6 +1114,12 @@
                   (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);
       





More information about the cfe-commits mailing list