aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2010-01-26 22:44:01 +0000
committerMike Stump <mrs@apple.com>2010-01-26 22:44:01 +0000
commit852f5ce688eb90543f72f1012edce8d12a319216 (patch)
treebea2cb9c2a74325ac009ce0147f80aaf939535d7
parent7783bfc066776a63d6a2cd28329d4d149647bfdc (diff)
Refine the non-virtual this adjustments for thunks by using the offset
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
-rw-r--r--lib/CodeGen/CGVtable.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index cb3f1816d8..b6bb385fe9 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -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);