[cfe-commits] r82736 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp lib/AST/RecordLayoutBuilder.h test/SemaCXX/empty-class-layout.cpp
Anders Carlsson
andersca at mac.com
Sat Sep 26 09:55:28 PDT 2009
26 sep 2009 kl. 09.36 skrev Daniel Dunbar:
> On Thu, Sep 24, 2009 at 5:02 PM, Anders Carlsson <andersca at mac.com>
> wrote:
>> void ASTRecordLayoutBuilder::UpdateEmptyClassOffsets(const
>> CXXRecordDecl *RD,
>> uint64_t
>> Offset) {
>> if (RD->isEmpty())
>> @@ -485,6 +497,17 @@
>>
>> // Round up the current record size to the field's alignment
>> boundary.
>> FieldOffset = llvm::RoundUpToAlignment(FieldOffset, FieldAlign);
>> +
>> + if (!IsUnion) {
>
> 'if (IsUnion) return;'?
That's not enough - we still need to place the field. We just don't
have to worry about empty classes when laying out union fields.
>
>> + while (true) {
>> + // Check if we can place the field at this offset.
>> + if (canPlaceFieldAtOffset(D, FieldOffset))
>> + break;
>> +
>> + // We can't try again.
>
> This comment is wrong?
Yes, fixed.
Thanks!
Anders
More information about the cfe-commits
mailing list