From 075de167f8f233b714a4a5e59cc1540368a632d4 Mon Sep 17 00:00:00 2001 From: Ken Dyck Date: Wed, 30 Mar 2011 01:21:33 +0000 Subject: [PATCH] Convert local offset variable to CharUnits in AddVCallOffsets. No change in functionality intended. llvm-svn: 128522 --- clang/lib/CodeGen/CGVTables.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index ac27ab8c6e22..a0d7c4cfc9c2 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -876,7 +876,7 @@ void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base, if (!VCallOffsets.AddVCallOffset(MD, OffsetOffset)) continue; - int64_t Offset = 0; + CharUnits Offset = CharUnits::Zero(); if (Overriders) { // Get the final overrider. @@ -885,11 +885,11 @@ void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base, /// 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).