[cfe-commits] r128522 - /cfe/trunk/lib/CodeGen/CGVTables.cpp

Ken Dyck kd at kendyck.com
Tue Mar 29 18:21:33 PDT 2011


Author: kjdyck
Date: Tue Mar 29 20:21:33 2011
New Revision: 128522

URL: http://llvm.org/viewvc/llvm-project?rev=128522&view=rev
Log:
Convert local offset variable to CharUnits in AddVCallOffsets. No change in
functionality intended.

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

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=128522&r1=128521&r2=128522&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Tue Mar 29 20:21:33 2011
@@ -876,7 +876,7 @@
     if (!VCallOffsets.AddVCallOffset(MD, OffsetOffset))
       continue;
 
-    int64_t Offset = 0;
+    CharUnits Offset = CharUnits::Zero();
 
     if (Overriders) {
       // Get the final overrider.
@@ -885,11 +885,11 @@
       
       /// The vcall offset is the offset from the virtual base to the object 
       /// where the function was overridden.
-      // FIXME: We should not use / 8 here.
-      Offset = (int64_t)(Context.toBits(Overrider.Offset) - VBaseOffset) / 8;
+      Offset = Overrider.Offset - Context.toCharUnitsFromBits(VBaseOffset);
     }
     
-    Components.push_back(VTableComponent::MakeVCallOffset(Offset));
+    Components.push_back(
+      VTableComponent::MakeVCallOffset(Offset.getQuantity()));
   }
 
   // And iterate over all non-virtual bases (ignoring the primary base).





More information about the cfe-commits mailing list