]> granicus.if.org Git - clang/commitdiff
Tweak the formula for non-virtual offsets to something which appears a bit
authorEli Friedman <eli.friedman@gmail.com>
Mon, 7 Dec 2009 04:38:34 +0000 (04:38 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 7 Dec 2009 04:38:34 +0000 (04:38 +0000)
more accurate.

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

lib/CodeGen/CGVtable.cpp

index d227a5e47efb4e94610ae4e24ad681f5780a8843..43c0fe7de1297dbc3b338a1c41fe669213217907 100644 (file)
@@ -376,8 +376,9 @@ public:
 
     D1(printf("  vfn for %s at %d\n", MD->getNameAsString().c_str(),
               (int)Index[GD]));
+
+    VCallOffset[GD] = Offset/8;
     if (MorallyVirtual) {
-      VCallOffset[GD] = Offset/8;
       Index_t &idx = VCall[GD];
       // Allocate the first one, after that, we reuse the previous one.
       if (idx == 0) {
@@ -844,8 +845,7 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, bool MorallyVirtual,
       return true;
     }
 
-    // FIXME: finish off
-    int64_t NonVirtualAdjustment = VCallOffset[OGD] - OverrideOffset/8;
+    int64_t NonVirtualAdjustment = -VCallOffset[OGD] + OverrideOffset/8;
 
     if (NonVirtualAdjustment) {
       ThunkAdjustment ThisAdjustment(NonVirtualAdjustment, 0);