[cfe-commits] r97067 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Anders Carlsson
andersca at mac.com
Wed Feb 24 14:27:12 PST 2010
Author: andersca
Date: Wed Feb 24 16:27:12 2010
New Revision: 97067
URL: http://llvm.org/viewvc/llvm-project?rev=97067&view=rev
Log:
Improve this adjustment pointer calculation.
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=97067&r1=97066&r2=97067&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Wed Feb 24 16:27:12 2010
@@ -1432,12 +1432,23 @@
ReturnAdjustment ReturnAdjustment =
ComputeReturnAdjustment(ReturnAdjustmentOffset);
- // Check if this overrider needs a 'this' pointer adjustment.
- BaseOffset ThisAdjustmentOffset =
- Overriders.getThisAdjustmentOffset(Base, MD);
+ ThisAdjustment ThisAdjustment;
- ThisAdjustment ThisAdjustment = ComputeThisAdjustment(Overrider.Method,
- ThisAdjustmentOffset);
+ // Check if this overrider needs a 'this' pointer adjustment.
+ // (We use the base offset of the first base in the primary base chain here,
+ // because Base will not have the right offset if it is a primary virtual
+ // base that is not a primary base in the complete class.
+ if (FirstBaseInPrimaryBaseChain.getBaseOffset() != Overrider.BaseOffset) {
+ BaseSubobject OverriderBaseSubobject(Overrider.Method->getParent(),
+ Overrider.BaseOffset);
+
+ BaseOffset ThisAdjustmentOffset =
+ Overriders.ComputeThisAdjustmentBaseOffset(FirstBaseInPrimaryBaseChain,
+ OverriderBaseSubobject);
+
+ ThisAdjustment = ComputeThisAdjustment(Overrider.Method,
+ ThisAdjustmentOffset);
+ }
AddMethod(Overrider.Method, ReturnAdjustment, ThisAdjustment);
}
More information about the cfe-commits
mailing list