[cfe-dev] Implementation of MSRecordLayoutBuilder.

r4start r4start at gmail.com
Thu Sep 15 03:20:58 PDT 2011


On 15/09/2011 00:39, r4start wrote:
> On 15/09/2011 00:36, John McCall wrote:
>> On Sep 14, 2011, at 1:33 PM, r4start wrote:
>>
>>> On 15/09/2011 00:24, John McCall wrote:
>>>> 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.
>>> You propose to duplicate the output to a file and then run FileCheck 
>>> to check output, am I right?
>> It would probably be better to run FileCheck directly on the output, but
>> I think you get the general idea.
>>
>> Whenever you get CGRecordLayoutBuilder working adequately, you can rip
>> out the new option and just use -dump-record-layouts.
>>
>> John.
> Ok, thanks. Tomorrow I'll do it.
>
Here is a test and patch.

- Dmitry.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: microsoft-layout-support.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110915/2efba0f2/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ms_class_layout.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110915/2efba0f2/attachment-0001.ksh>


More information about the cfe-dev mailing list