aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorKen Dyck <kd@kendyck.com>2011-03-24 01:21:01 +0000
committerKen Dyck <kd@kendyck.com>2011-03-24 01:21:01 +0000
commit4230d529a8797bbeef2328b60abeae333f7e143f (patch)
treea30b3df0dba3159ddbf6d5f22a3bbc86c46b3548 /lib/CodeGen/CGClass.cpp
parent2b32dad701ef3e666e3b9cea02e1d094a1078c6f (diff)
Convert the BaseOffset member of BaseSubobject to CharUnits from bits. No
change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r--lib/CodeGen/CGClass.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 64b1615d7c..b852529248 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -305,9 +305,9 @@ static llvm::Value *GetVTTParameter(CodeGenFunction &CGF, GlobalDecl GD,
} else {
const ASTRecordLayout &Layout =
CGF.getContext().getASTRecordLayout(RD);
- uint64_t BaseOffset = ForVirtualBase ?
- Layout.getVBaseClassOffsetInBits(Base) :
- Layout.getBaseClassOffsetInBits(Base);
+ CharUnits BaseOffset = ForVirtualBase ?
+ Layout.getVBaseClassOffset(Base) :
+ Layout.getBaseClassOffset(Base);
SubVTTIndex =
CGF.CGM.getVTables().getSubVTTIndex(RD, BaseSubobject(Base, BaseOffset));
@@ -1378,8 +1378,7 @@ CodeGenFunction::InitializeVTablePointer(BaseSubobject Base,
NonVirtualOffset = OffsetFromNearestVBase;
} else {
// We can just use the base offset in the complete class.
- NonVirtualOffset =
- CGM.getContext().toCharUnitsFromBits(Base.getBaseOffset());
+ NonVirtualOffset = Base.getBaseOffset();
}
// Apply the offsets.
@@ -1443,16 +1442,13 @@ CodeGenFunction::InitializeVTablePointers(BaseSubobject Base,
} else {
const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD);
- BaseOffset =
- getContext().toCharUnitsFromBits(Base.getBaseOffset()) +
- Layout.getBaseClassOffset(BaseDecl);
+ BaseOffset = Base.getBaseOffset() + Layout.getBaseClassOffset(BaseDecl);
BaseOffsetFromNearestVBase =
OffsetFromNearestVBase + Layout.getBaseClassOffset(BaseDecl);
BaseDeclIsNonVirtualPrimaryBase = Layout.getPrimaryBase() == BaseDecl;
}
- InitializeVTablePointers(BaseSubobject(BaseDecl,
- getContext().toBits(BaseOffset)),
+ InitializeVTablePointers(BaseSubobject(BaseDecl, BaseOffset),
I->isVirtual() ? BaseDecl : NearestVBase,
BaseOffsetFromNearestVBase,
BaseDeclIsNonVirtualPrimaryBase,
@@ -1470,7 +1466,8 @@ void CodeGenFunction::InitializeVTablePointers(const CXXRecordDecl *RD) {
// Initialize the vtable pointers for this class and all of its bases.
VisitedVirtualBasesSetTy VBases;
- InitializeVTablePointers(BaseSubobject(RD, 0), /*NearestVBase=*/0,
+ InitializeVTablePointers(BaseSubobject(RD, CharUnits::Zero()),
+ /*NearestVBase=*/0,
/*OffsetFromNearestVBase=*/CharUnits::Zero(),
/*BaseIsNonVirtualPrimaryBase=*/false,
VTable, RD, VBases);