[cfe-commits] r77087 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp lib/CodeGen/CGCXX.cpp lib/CodeGen/CodeGenTypes.cpp test/CodeGenCXX/constructor-init.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Jul 28 10:02:32 PDT 2009


On Jul 28, 2009, at 9:44 AM, Anders Carlsson wrote:

>
> On Jul 25, 2009, at 2:12 PM, Fariborz Jahanian wrote:
>
>> Author: fjahanian
>> Date: Sat Jul 25 16:12:28 2009
>> New Revision: 77087
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=77087&view=rev
>> Log:
>> ir-gen for non-virtual base class initialization
>> in constructors.
>>
>
> Cool.
>
>> Added:
>>   cfe/trunk/test/CodeGenCXX/constructor-init.cpp
>> Modified:
>>   cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
>>   cfe/trunk/lib/CodeGen/CGCXX.cpp
>>   cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>>
>> Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=77087&r1=77086&r2=77087&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
>> +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Sat Jul 25 16:12:28  
>> 2009
>> @@ -53,6 +53,9 @@
>>  // Round up the current record size to the base's alignment  
>> boundary.
>>  Size = (Size + (BaseAlign-1)) & ~(BaseAlign-1);
>>
>> +  // Non-virtual base class has offset too.
>> +  FieldOffsets.push_back(Size);
>> +
>
> I intentionally did not emit field offsets for base classes because:
>
> 1. They're somewhat different from regular fields
> 2. This makes the FieldOffsets mean something different in C++ vs C.
>
> I have a patch that implements type layout for non-virtual base  
> classes and I plan to land it later today.

I thought that this would change. I hope also that I would be able to  
get the offset of each base laid out in the current class
by a suitable API after your changes.

- Thanks, Fariborz

>
>
> Anders




More information about the cfe-commits mailing list