[cfe-commits] r128756 - /cfe/trunk/lib/CodeGen/CGVTables.cpp
Ken Dyck
kd at kendyck.com
Fri Apr 1 18:32:03 PDT 2011
Author: kjdyck
Date: Fri Apr 1 20:32:03 2011
New Revision: 128756
URL: http://llvm.org/viewvc/llvm-project?rev=128756&view=rev
Log:
Convert BaseOffset::NonVirtualOffset to CharUnits. 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=128756&r1=128755&r2=128756&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Fri Apr 1 20:32:03 2011
@@ -43,15 +43,16 @@
/// (Or the offset from the virtual base class to the base class, if the
/// path from the derived class to the base class involves a virtual base
/// class.
- int64_t NonVirtualOffset;
+ CharUnits NonVirtualOffset;
- BaseOffset() : DerivedClass(0), VirtualBase(0), NonVirtualOffset(0) { }
+ BaseOffset() : DerivedClass(0), VirtualBase(0),
+ NonVirtualOffset(CharUnits::Zero()) { }
BaseOffset(const CXXRecordDecl *DerivedClass,
- const CXXRecordDecl *VirtualBase, int64_t NonVirtualOffset)
+ const CXXRecordDecl *VirtualBase, CharUnits NonVirtualOffset)
: DerivedClass(DerivedClass), VirtualBase(VirtualBase),
NonVirtualOffset(NonVirtualOffset) { }
- bool isEmpty() const { return !NonVirtualOffset && !VirtualBase; }
+ bool isEmpty() const { return NonVirtualOffset.isZero() && !VirtualBase; }
};
/// FinalOverriders - Contains the final overrider member functions for all
@@ -214,7 +215,7 @@
static BaseOffset ComputeBaseOffset(ASTContext &Context,
const CXXRecordDecl *DerivedRD,
const CXXBasePath &Path) {
- int64_t NonVirtualOffset = 0;
+ CharUnits NonVirtualOffset = CharUnits::Zero();
unsigned NonVirtualStart = 0;
const CXXRecordDecl *VirtualBase = 0;
@@ -243,13 +244,13 @@
const RecordType *BaseType = Element.Base->getType()->getAs<RecordType>();
const CXXRecordDecl *Base = cast<CXXRecordDecl>(BaseType->getDecl());
- NonVirtualOffset += Layout.getBaseClassOffsetInBits(Base);
+ NonVirtualOffset += Layout.getBaseClassOffset(Base);
}
// FIXME: This should probably use CharUnits or something. Maybe we should
// even change the base offsets in ASTRecordLayout to be specified in
// CharUnits.
- return BaseOffset(DerivedRD, VirtualBase, NonVirtualOffset / 8);
+ return BaseOffset(DerivedRD, VirtualBase, NonVirtualOffset);
}
@@ -433,7 +434,7 @@
if (Offset.VirtualBase)
Out << Offset.VirtualBase->getQualifiedNameAsString() << " vbase, ";
- Out << Offset.NonVirtualOffset << " nv]";
+ Out << Offset.NonVirtualOffset.getQuantity() << " nv]";
}
Out << "\n";
@@ -1342,7 +1343,7 @@
}
}
- Adjustment.NonVirtual = Offset.NonVirtualOffset;
+ Adjustment.NonVirtual = Offset.NonVirtualOffset.getQuantity();
}
return Adjustment;
@@ -1369,8 +1370,7 @@
I != E; ++I) {
BaseOffset Offset = ComputeBaseOffset(Context, DerivedRD, *I);
- CharUnits OffsetToBaseSubobject =
- CharUnits::fromQuantity(Offset.NonVirtualOffset);
+ CharUnits OffsetToBaseSubobject = Offset.NonVirtualOffset;
if (Offset.VirtualBase) {
// If we have a virtual base class, the non-virtual offset is relative
@@ -1445,7 +1445,7 @@
}
// Set the non-virtual part of the adjustment.
- Adjustment.NonVirtual = Offset.NonVirtualOffset;
+ Adjustment.NonVirtual = Offset.NonVirtualOffset.getQuantity();
return Adjustment;
}
More information about the cfe-commits
mailing list