[cfe-commits] r98198 - in /cfe/trunk/lib/AST: RecordLayoutBuilder.cpp RecordLayoutBuilder.h
Anders Carlsson
andersca at mac.com
Wed Mar 10 14:26:24 PST 2010
Author: andersca
Date: Wed Mar 10 16:26:24 2010
New Revision: 98198
URL: http://llvm.org/viewvc/llvm-project?rev=98198&view=rev
Log:
Get rid of the LayoutBaseNonVirtually; it was used to lay out a base either as a non-virtual base or a virtual base.
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=98198&r1=98197&r2=98198&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Mar 10 16:26:24 2010
@@ -181,14 +181,20 @@
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
// Skip the PrimaryBase here, as it is laid down first.
- if (Base != PrimaryBase.getBase() || PrimaryBase.isVirtual())
- LayoutBaseNonVirtually(Base, false);
+ if (Base != PrimaryBase.getBase() || PrimaryBase.isVirtual()) {
+ // Lay out the base.
+ LayoutNonVirtualBase(Base);
+ }
}
}
}
void ASTRecordLayoutBuilder::LayoutNonVirtualBase(const CXXRecordDecl *RD) {
- LayoutBaseNonVirtually(RD, false);
+ // Layout the base.
+ uint64_t Offset = LayoutBase(RD);
+
+ // Add its base class offset.
+ Bases.push_back(std::make_pair(RD, Offset));
}
void ASTRecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *Class,
@@ -244,7 +250,11 @@
}
void ASTRecordLayoutBuilder::LayoutVirtualBase(const CXXRecordDecl *RD) {
- LayoutBaseNonVirtually(RD, true);
+ // Layout the base.
+ uint64_t Offset = LayoutBase(RD);
+
+ // Add its base class offset.
+ VBases.push_back(std::make_pair(RD, Offset));
}
uint64_t ASTRecordLayoutBuilder::LayoutBase(const CXXRecordDecl *RD) {
@@ -434,18 +444,6 @@
}
}
-void ASTRecordLayoutBuilder::LayoutBaseNonVirtually(const CXXRecordDecl *RD,
- bool IsVirtualBase) {
- // Layout the base.
- uint64_t Offset = LayoutBase(RD);
-
- // Add base class offsets.
- if (IsVirtualBase)
- VBases.push_back(std::make_pair(RD, Offset));
- else
- Bases.push_back(std::make_pair(RD, Offset));
-}
-
void ASTRecordLayoutBuilder::Layout(const RecordDecl *D) {
IsUnion = D->isUnion();
@@ -464,9 +462,13 @@
LayoutVtable(RD);
// PrimaryBase goes first.
if (PrimaryBase.getBase()) {
- if (PrimaryBase.isVirtual())
+ if (PrimaryBase.isVirtual()) {
IndirectPrimaryBases.insert(PrimaryBase.getBase());
- LayoutBaseNonVirtually(PrimaryBase.getBase(), PrimaryBase.isVirtual());
+
+ LayoutVirtualBase(PrimaryBase.getBase());
+ } else {
+ LayoutNonVirtualBase(PrimaryBase.getBase());
+ }
}
LayoutNonVirtualBases(RD);
}
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.h?rev=98198&r1=98197&r2=98198&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Wed Mar 10 16:26:24 2010
@@ -122,7 +122,6 @@
uint64_t LayoutBase(const CXXRecordDecl *RD);
void LayoutVtable(const CXXRecordDecl *RD);
- void LayoutBaseNonVirtually(const CXXRecordDecl *RD, bool IsVBase);
/// canPlaceRecordAtOffset - Return whether a record (either a base class
/// or a field) can be placed at the given offset.
More information about the cfe-commits
mailing list