[cfe-commits] r128776 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGDebugInfo.cpp CGRTTI.cpp CGVTables.cpp CGVTables.h
Ken Dyck
kd at kendyck.com
Sat Apr 2 10:52:22 PDT 2011
Author: kjdyck
Date: Sat Apr 2 12:52:22 2011
New Revision: 128776
URL: http://llvm.org/viewvc/llvm-project?rev=128776&view=rev
Log:
Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGRTTI.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CGVTables.h
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=128776&r1=128775&r2=128776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Apr 2 12:52:22 2011
@@ -1317,11 +1317,12 @@
const CXXRecordDecl *ClassDecl,
const CXXRecordDecl *BaseClassDecl) {
llvm::Value *VTablePtr = GetVTablePtr(This, Int8PtrTy);
- int64_t VBaseOffsetOffset =
+ CharUnits VBaseOffsetOffset =
CGM.getVTables().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
llvm::Value *VBaseOffsetPtr =
- Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset, "vbase.offset.ptr");
+ Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset.getQuantity(),
+ "vbase.offset.ptr");
const llvm::Type *PtrDiffTy =
ConvertType(getContext().getPointerDiffType());
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=128776&r1=128775&r2=128776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Apr 2 12:52:22 2011
@@ -808,7 +808,7 @@
for (CXXRecordDecl::base_class_const_iterator BI = RD->bases_begin(),
BE = RD->bases_end(); BI != BE; ++BI) {
unsigned BFlags = 0;
- uint64_t BaseOffset;
+ CharUnits BaseOffset;
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
@@ -816,10 +816,11 @@
if (BI->isVirtual()) {
// virtual base offset offset is -ve. The code generator emits dwarf
// expression where it expects +ve number.
- BaseOffset = 0 - CGM.getVTables().getVirtualBaseOffsetOffset(RD, Base);
+ BaseOffset = CharUnits::Zero() -
+ CGM.getVTables().getVirtualBaseOffsetOffset(RD, Base);
BFlags = llvm::DIDescriptor::FlagVirtual;
} else
- BaseOffset = RL.getBaseClassOffsetInBits(Base);
+ BaseOffset = RL.getBaseClassOffset(Base);
AccessSpecifier Access = BI->getAccessSpecifier();
if (Access == clang::AS_private)
@@ -830,7 +831,7 @@
llvm::DIType DTy =
DBuilder.createInheritance(RecordTy,
getOrCreateType(BI->getType(), Unit),
- BaseOffset, BFlags);
+ BaseOffset.getQuantity(), BFlags);
EltTys.push_back(DTy);
}
}
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=128776&r1=128775&r2=128776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Sat Apr 2 12:52:22 2011
@@ -877,7 +877,8 @@
// subobject. For a virtual base, this is the offset in the virtual table of
// the virtual base offset for the virtual base referenced (negative).
if (Base->isVirtual())
- OffsetFlags = CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl);
+ OffsetFlags =
+ CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl).getQuantity();
else {
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
OffsetFlags = Layout.getBaseClassOffsetInBits(BaseDecl) / 8;
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=128776&r1=128775&r2=128776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Sat Apr 2 12:52:22 2011
@@ -1339,7 +1339,7 @@
} else {
Adjustment.VBaseOffsetOffset =
VTables.getVirtualBaseOffsetOffset(Offset.DerivedClass,
- Offset.VirtualBase);
+ Offset.VirtualBase).getQuantity();
}
}
@@ -2431,14 +2431,15 @@
return I->second;
}
-int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
- const CXXRecordDecl *VBase) {
+CharUnits
+CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
+ const CXXRecordDecl *VBase) {
ClassPairTy ClassPair(RD, VBase);
VirtualBaseClassOffsetOffsetsMapTy::iterator I =
VirtualBaseClassOffsetOffsets.find(ClassPair);
if (I != VirtualBaseClassOffsetOffsets.end())
- return I->second.getQuantity();
+ return I->second;
VCallAndVBaseOffsetBuilder Builder(RD, RD, /*FinalOverriders=*/0,
BaseSubobject(RD, CharUnits::Zero()),
@@ -2458,7 +2459,7 @@
I = VirtualBaseClassOffsetOffsets.find(ClassPair);
assert(I != VirtualBaseClassOffsetOffsets.end() && "Did not find index!");
- return I->second.getQuantity();
+ return I->second;
}
uint64_t
Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=128776&r1=128775&r2=128776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Sat Apr 2 12:52:22 2011
@@ -235,13 +235,13 @@
/// stored.
uint64_t getMethodVTableIndex(GlobalDecl GD);
- /// getVirtualBaseOffsetOffset - Return the offset in bytes (relative to the
+ /// getVirtualBaseOffsetOffset - Return the offset in chars (relative to the
/// vtable address point) where the offset of the virtual base that contains
/// the given base is stored, otherwise, if no virtual base contains the given
/// class, return 0. Base must be a virtual base class or an unambigious
/// base.
- int64_t getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
- const CXXRecordDecl *VBase);
+ CharUnits getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
+ const CXXRecordDecl *VBase);
/// getAddressPoint - Get the address point of the given subobject in the
/// class decl.
More information about the cfe-commits
mailing list