Rename NextOffset to DataSize, which better matches the Itanium C++ ABI

llvm-svn: 76339
This commit is contained in:
Anders Carlsson 2009-07-18 21:26:44 +00:00
parent a4267a654b
commit 27b50135ee
3 changed files with 9 additions and 10 deletions

View File

@ -30,17 +30,16 @@ namespace clang {
/// These objects are managed by ASTContext. /// These objects are managed by ASTContext.
class ASTRecordLayout { class ASTRecordLayout {
uint64_t Size; // Size of record in bits. uint64_t Size; // Size of record in bits.
uint64_t NextOffset; // Next available offset uint64_t DataSize; // Size of record in bits without tail padding.
uint64_t *FieldOffsets; uint64_t *FieldOffsets;
unsigned Alignment; // Alignment of record in bits. unsigned Alignment; // Alignment of record in bits.
unsigned FieldCount; // Number of fields unsigned FieldCount; // Number of fields
friend class ASTContext; friend class ASTContext;
friend class ASTRecordLayoutBuilder; friend class ASTRecordLayoutBuilder;
ASTRecordLayout(uint64_t Size, unsigned Alignment, ASTRecordLayout(uint64_t size, unsigned alignment, unsigned datasize,
unsigned nextoffset,
const uint64_t *fieldoffsets, unsigned fieldcount) const uint64_t *fieldoffsets, unsigned fieldcount)
: Size(Size), NextOffset(nextoffset), FieldOffsets(0), Alignment(Alignment), : Size(size), DataSize(datasize), FieldOffsets(0), Alignment(alignment),
FieldCount(fieldcount) { FieldCount(fieldcount) {
if (FieldCount > 0) { if (FieldCount > 0) {
FieldOffsets = new uint64_t[FieldCount]; FieldOffsets = new uint64_t[FieldCount];
@ -72,10 +71,10 @@ public:
return FieldOffsets[FieldNo]; return FieldOffsets[FieldNo];
} }
/// getNextOffset - Get the next available (unused) offset in the /// getDataSize() - Get the record data size, which is the record size
/// structure, in bits. /// without tail padding, in bits.
uint64_t getNextOffset() const { uint64_t getDataSize() const {
return NextOffset; return DataSize;
} }
}; };

View File

@ -52,7 +52,7 @@ void ASTRecordLayoutBuilder::Layout(const ObjCInterfaceDecl *D,
// We start laying out ivars not at the end of the superclass // We start laying out ivars not at the end of the superclass
// structure, but at the next byte following the last field. // structure, but at the next byte following the last field.
Size = llvm::RoundUpToAlignment(SL.NextOffset, 8); Size = llvm::RoundUpToAlignment(SL.getDataSize(), 8);
NextOffset = Size; NextOffset = Size;
} }

View File

@ -4319,7 +4319,7 @@ void CGObjCNonFragileABIMac::GetClassSizeInfo(const ObjCImplementationDecl *OID,
CGM.getContext().getASTObjCImplementationLayout(OID); CGM.getContext().getASTObjCImplementationLayout(OID);
// InstanceSize is really instance end. // InstanceSize is really instance end.
InstanceSize = llvm::RoundUpToAlignment(RL.getNextOffset(), 8) / 8; InstanceSize = llvm::RoundUpToAlignment(RL.getDataSize(), 8) / 8;
// If there are no fields, the start is the same as the end. // If there are no fields, the start is the same as the end.
if (!RL.getFieldCount()) if (!RL.getFieldCount())