[cfe-dev] Implementation of MSRecordLayoutBuilder.

John McCall rjmccall at apple.com
Wed Sep 14 13:24:42 PDT 2011


On Sep 14, 2011, at 1:23 PM, r4start wrote:
> On 14/09/2011 21:53, John McCall wrote:
>> On Sep 14, 2011, at 4:05 AM, r4start wrote:
>> 
>>> On 14/09/2011 00:42, r4start wrote:
>>>> On 14/09/2011 00:37, Eli Friedman wrote:
>>>>> On Mon, Sep 12, 2011 at 11:45 PM, r4start<r4start at gmail.com>   wrote:
>>>>>> On 12/09/2011 21:57, r4start wrote:
>>>>>>> On 12/09/2011 21:37, Eli Friedman wrote:
>>>>>>>> On Mon, Sep 12, 2011 at 8:56 AM, r4start<r4start at gmail.com>     wrote:
>>>>>>>>> Hi,
>>>>>>>>> I have some prototype code for MSRecordLayoutBuilder. I test
>>>>>>>>> this code
>>>>>>>>> with MSVS 2010 and \Zp8 compiler option. On simple examples it
>>>>>>>>> seems to
>>>>>>>>> work properly.
>>>>>>>>> 
>>>>>>>>> Is it interesting to the clang project?
>>>>>>>> We certainly want to fix any cases where clang does not do struct
>>>>>>>> layout consistently with MSVC on Windows.  It's hard to comment on
>>>>>>>> your patch without seeing it.
>>>>>>>> 
>>>>>>>> -Eli
>>>>>>> Now I'm not at work. When I come to work I'll send a patch.
>>>>>>> 
>>>>>>> - Dmitry
>>>>>> Here is patch for MSRecordLayoutBuilder.
>>>>> I think it would be better to integrate the checks into the main
>>>>> RecordLayoutBuilder class rather than subclassing it.
>>>>> 
>>>>> Please include tests in your patch.  (See test/CodeGen/ms_struct.c for
>>>>> an example.)
>>>>> 
>>>>> I would like someone more familiar with MSVC to review the actual
>>>>> logic here (ping me if nobody does within a few days, though, and I'll
>>>>> try to review anyway).
>>>>> 
>>>>> -Eli
>>>> Ok, thanks for hint.
>>>> 
>>>> -Dmitry.
>>> I have a problem when writing a test. Clang doesn't implement Microsoft
>>> ABI and he crashes at code generation stage.
>>> Clang have dump-record-layouts option but he prints AST layouts and
>>> CodeGen layouts.
>>> 
>>> Is there a way to save only AST record layout to file and then check
>>> or maybe my patch must include CGRecordLayoutBuilder for Microsoft?
>> It would be easy enough to add a new testing switch if you'd like to get this in.
> Can you give me some hint how can I do this?

Follow the code for -dump-record-layouts.

>>> I`m working on CGRecordLayoutBuilder for Microsoft but I have problems
>>> with vbtables.
>>> Itanium ABI doesn't have vbtables and Microsoft ABI doesn't have VTT. It
>>> is quite heavy task.
>> Yeah, there's a lot of abstraction work to be done here.
> In simple tests my code already work but if class has many bases and they have other bases it crashes.

If it crashes unconditionally without your patch, then this is incremental progress. :)

John



More information about the cfe-dev mailing list