diff options
author | Ken Dyck <kd@kendyck.com> | 2011-04-09 01:09:56 +0000 |
---|---|---|
committer | Ken Dyck <kd@kendyck.com> | 2011-04-09 01:09:56 +0000 |
commit | b653d5ac2f1afab5bf3256145c4112754f4b5779 (patch) | |
tree | f821b8533fa8dba401258ac99e6ad6f301cafc28 /lib/CodeGen/CGRTTI.cpp | |
parent | a00d678f32f44668f42112a749fd4fe9c6e061e5 (diff) |
Eliminate a divide-by-8 in BuildVMIClassTypeInfo() by using CharUnits for
the base offset. No change in functionality intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRTTI.cpp')
-rw-r--r-- | lib/CodeGen/CGRTTI.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp index fb89f4ca00..b8d234f8a6 100644 --- a/lib/CodeGen/CGRTTI.cpp +++ b/lib/CodeGen/CGRTTI.cpp @@ -877,15 +877,16 @@ void RTTIBuilder::BuildVMIClassTypeInfo(const CXXRecordDecl *RD) { // For a non-virtual base, this is the offset in the object of the base // subobject. For a virtual base, this is the offset in the virtual table of // the virtual base offset for the virtual base referenced (negative). + CharUnits Offset; if (Base->isVirtual()) - OffsetFlags = - CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl).getQuantity(); + Offset = + CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl); else { const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD); - OffsetFlags = Layout.getBaseClassOffsetInBits(BaseDecl) / 8; + Offset = Layout.getBaseClassOffset(BaseDecl); }; - OffsetFlags <<= 8; + OffsetFlags = Offset.getQuantity() << 8; // The low-order byte of __offset_flags contains flags, as given by the // masks from the enumeration __offset_flags_masks. |