[cfe-commits] r103403 - in /cfe/trunk/lib/AST: RecordLayoutBuilder.cpp RecordLayoutBuilder.h
Anders Carlsson
andersca at mac.com
Mon May 10 08:28:59 PDT 2010
Author: andersca
Date: Mon May 10 10:28:59 2010
New Revision: 103403
URL: http://llvm.org/viewvc/llvm-project?rev=103403&view=rev
Log:
Add an UpdateVBases parameter to UpdateEmptyClassOffsets. Not used just yet.
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/lib/AST/RecordLayoutBuilder.h
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=103403&r1=103402&r2=103403&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Mon May 10 10:28:59 2010
@@ -377,7 +377,7 @@
// If we have an empty base class, try to place it at offset 0.
if (RD->isEmpty() && canPlaceRecordAtOffset(RD, 0, /*CheckVBases=*/false)) {
// We were able to place the class at offset 0.
- UpdateEmptyClassOffsets(RD, 0);
+ UpdateEmptyClassOffsets(RD, 0, /*UpdateVBases=*/false);
Size = std::max(Size, Layout.getSize());
@@ -408,7 +408,7 @@
// Remember max struct/class alignment.
UpdateAlignment(BaseAlign);
- UpdateEmptyClassOffsets(RD, Offset);
+ UpdateEmptyClassOffsets(RD, Offset, /*UpdateVBases=*/false);
return Offset;
}
@@ -497,7 +497,8 @@
}
void ASTRecordLayoutBuilder::UpdateEmptyClassOffsets(const CXXRecordDecl *RD,
- uint64_t Offset) {
+ uint64_t Offset,
+ bool UpdateVBases) {
if (RD->isEmpty())
EmptyClassOffsets.insert(std::make_pair(Offset, RD));
@@ -515,7 +516,8 @@
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
uint64_t BaseClassOffset = Layout.getBaseClassOffset(Base);
- UpdateEmptyClassOffsets(Base, Offset + BaseClassOffset);
+ UpdateEmptyClassOffsets(Base, Offset + BaseClassOffset,
+ /*UpdateVBases=*/false);
}
// Update fields.
@@ -528,7 +530,9 @@
UpdateEmptyClassOffsets(FD, Offset + FieldOffset);
}
- // FIXME: Update virtual bases.
+ if (UpdateVBases) {
+ // FIXME: Update virtual bases.
+ }
}
void
@@ -538,7 +542,7 @@
if (const RecordType *RT = T->getAs<RecordType>()) {
if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
- UpdateEmptyClassOffsets(RD, Offset);
+ UpdateEmptyClassOffsets(RD, Offset, /*UpdateVBases=*/true);
return;
}
}
@@ -558,7 +562,7 @@
uint64_t ElementOffset = Offset;
for (uint64_t I = 0; I != NumElements; ++I) {
- UpdateEmptyClassOffsets(RD, ElementOffset);
+ UpdateEmptyClassOffsets(RD, ElementOffset, /*UpdateVBases=*/true);
ElementOffset += Info.getSize();
}
}
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.h?rev=103403&r1=103402&r2=103403&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Mon May 10 10:28:59 2010
@@ -151,7 +151,8 @@
/// or a field) has been placed at the given offset. Will update the
/// EmptyClassOffsets map if the class is empty or has any empty bases or
/// fields.
- void UpdateEmptyClassOffsets(const CXXRecordDecl *RD, uint64_t Offset);
+ void UpdateEmptyClassOffsets(const CXXRecordDecl *RD, uint64_t Offset,
+ bool UpdateVBases);
/// UpdateEmptyClassOffsets - Called after a field has been placed at the
/// given offset.
More information about the cfe-commits
mailing list