[cfe-commits] r82832 - in /cfe/trunk/lib/AST: RecordLayoutBuilder.cpp RecordLayoutBuilder.h
Anders Carlsson
andersca at mac.com
Fri Sep 25 18:34:51 PDT 2009
Author: andersca
Date: Fri Sep 25 20:34:51 2009
New Revision: 82832
URL: http://llvm.org/viewvc/llvm-project?rev=82832&view=rev
Log:
Rename NextOffset to DataSize.
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=82832&r1=82831&r2=82832&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Sep 25 20:34:51 2009
@@ -23,7 +23,7 @@
ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx)
: Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0),
- NextOffset(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8),
+ DataSize(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8),
PrimaryBase(0), PrimaryBaseWasVirtual(false) {}
/// LayoutVtable - Lay out the vtable and set PrimaryBase.
@@ -38,7 +38,7 @@
int AS = 0;
UpdateAlignment(Ctx.Target.getPointerAlign(AS));
Size += Ctx.Target.getPointerWidth(AS);
- NextOffset = Size;
+ DataSize = Size;
}
}
@@ -377,7 +377,7 @@
unsigned BaseAlign = BaseInfo.getNonVirtualAlign();
// Round up the current record size to the base's alignment boundary.
- uint64_t Offset = llvm::RoundUpToAlignment(NextOffset, BaseAlign);
+ uint64_t Offset = llvm::RoundUpToAlignment(DataSize, BaseAlign);
// Try to place the base.
while (true) {
@@ -388,10 +388,10 @@
}
if (!RD->isEmpty()) {
- // Remember the next available offset.
- NextOffset = Offset + BaseInfo.getNonVirtualSize();
+ // Update the data size.
+ DataSize = Offset + BaseInfo.getNonVirtualSize();
- Size = std::max(Size, NextOffset);
+ Size = std::max(Size, DataSize);
} else
Size = std::max(Size, Offset + BaseInfo.getSize());
@@ -480,7 +480,7 @@
// We start laying out ivars not at the end of the superclass
// structure, but at the next byte following the last field.
Size = llvm::RoundUpToAlignment(SL.getDataSize(), 8);
- NextOffset = Size;
+ DataSize = Size;
}
Packed = D->hasAttr<PackedAttr>();
@@ -513,7 +513,7 @@
void ASTRecordLayoutBuilder::LayoutField(const FieldDecl *D) {
bool FieldPacked = Packed;
- uint64_t FieldOffset = IsUnion ? 0 : NextOffset;
+ uint64_t FieldOffset = IsUnion ? 0 : DataSize;
uint64_t FieldSize;
unsigned FieldAlign;
@@ -598,8 +598,8 @@
else
Size = FieldOffset + FieldSize;
- // Remember the next available offset.
- NextOffset = Size;
+ // Update the data size.
+ DataSize = Size;
// Remember max struct/class alignment.
UpdateAlignment(FieldAlign);
@@ -642,7 +642,7 @@
// FIXME: This should be done in FinalizeLayout.
uint64_t DataSize =
- IsPODForThePurposeOfLayout ? Builder.Size : Builder.NextOffset;
+ IsPODForThePurposeOfLayout ? Builder.Size : Builder.DataSize;
uint64_t NonVirtualSize =
IsPODForThePurposeOfLayout ? DataSize : Builder.NonVirtualSize;
@@ -668,7 +668,7 @@
Builder.Layout(D, Impl);
return new ASTRecordLayout(Builder.Size, Builder.Alignment,
- Builder.NextOffset,
+ Builder.DataSize,
Builder.FieldOffsets.data(),
Builder.FieldOffsets.size());
}
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.h?rev=82832&r1=82831&r2=82832&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Fri Sep 25 20:34:51 2009
@@ -31,9 +31,16 @@
unsigned Alignment;
llvm::SmallVector<uint64_t, 16> FieldOffsets;
+ /// Packed - Whether the record is packed or not.
bool Packed;
+
+ /// MaxFieldAlignment - The maximum allowed field alignment. This is set by
+ /// #pragma pack.
unsigned MaxFieldAlignment;
- uint64_t NextOffset;
+
+ /// DataSize - The data size of the record being laid out.
+ uint64_t DataSize;
+
bool IsUnion;
uint64_t NonVirtualSize;
More information about the cfe-commits
mailing list