<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 15/09/2011 14:52, Don Williamson wrote:
    <blockquote
      cite="mid:1316083965.8881.YahooMailNeo@web161708.mail.bf1.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff; font-family:arial,
        helvetica, sans-serif;font-size:10pt">
        <div><span>Hi Dmitry,</span></div>
        <div><span><br>
          </span></div>
        <div><span>I'm really interested in the original test cases you
            have that failed with the original implementation of the
            record layout builder - could you share them?</span></div>
        <div><span><br>
          </span></div>
        <div><span>How does your current patch work with the following
            test:</span></div>
        <div><span><br>
          </span></div>
        <div><span>#pragma pack(push, 8)</span></div>
        <div><span>class B {</span></div>
        <div><span>public:</span></div>
        <div>  virtual void b(){}</div>
        <div>  int a;</div>
        <div>  double b;</div>
        <div><span>};</span></div>
        <div><span>#pragma pack(pop)</span></div>
        <div><span><br>
          </span></div>
        <div><span>Have you also tried test cases with and without
            constructors?</span></div>
        <div><span><br>
          </span></div>
        <div><span>Thanks,</span></div>
        <div><span>- Don</span></div>
        <div><br>
        </div>
        <div style="font-size: 10pt; font-family: arial, helvetica,
          sans-serif; ">
          <div style="font-size: 12pt; font-family: 'times new roman',
            'new york', times, serif; "><font face="Arial" size="2">
              <hr size="1"><b><span style="font-weight:bold;">From:</span></b>
              r4start <a class="moz-txt-link-rfc2396E" href="mailto:r4start@gmail.com"><r4start@gmail.com></a><br>
              <b><span style="font-weight: bold;">To:</span></b> John
              McCall <a class="moz-txt-link-rfc2396E" href="mailto:rjmccall@apple.com"><rjmccall@apple.com></a><br>
              <b><span style="font-weight: bold;">Cc:</span></b>
              <a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
              <b><span style="font-weight: bold;">Sent:</span></b>
              Thursday, September 15, 2011 11:20 AM<br>
              <b><span style="font-weight: bold;">Subject:</span></b>
              Re: [cfe-dev] Implementation of MSRecordLayoutBuilder.<br>
            </font><br>
            On 15/09/2011 00:39, r4start wrote:<br>
            > On 15/09/2011 00:36, John McCall wrote:<br>
            >> On Sep 14, 2011, at 1:33 PM, r4start wrote:<br>
            >> <br>
            >>> On 15/09/2011 00:24, John McCall wrote:<br>
            >>>> On Sep 14, 2011, at 1:23 PM, r4start wrote:<br>
            >>>>> On 14/09/2011 21:53, John McCall wrote:<br>
            >>>>>> On Sep 14, 2011, at 4:05 AM,
            r4start wrote:<br>
            >>>>>> <br>
            >>>>>>> On 14/09/2011 00:42, r4start
            wrote:<br>
            >>>>>>>> On 14/09/2011 00:37, Eli
            Friedman wrote:<br>
            >>>>>>>>> On Mon, Sep 12, 2011 at
            11:45 PM, r4start<<a moz-do-not-send="true"
              ymailto="mailto:r4start@gmail.com"
              href="mailto:r4start@gmail.com">r4start@gmail.com</a>> 
              wrote:<br>
            >>>>>>>>>> On 12/09/2011
            21:57, r4start wrote:<br>
            >>>>>>>>>>> On 12/09/2011
            21:37, Eli Friedman wrote:<br>
            >>>>>>>>>>>> On Mon, Sep
            12, 2011 at 8:56 AM, r4start<<a moz-do-not-send="true"
              ymailto="mailto:r4start@gmail.com"
              href="mailto:r4start@gmail.com">r4start@gmail.com</a>> 
                wrote:<br>
            >>>>>>>>>>>>> Hi,<br>
            >>>>>>>>>>>>> I have
            some prototype code for MSRecordLayoutBuilder. I test<br>
            >>>>>>>>>>>>> this
            code<br>
            >>>>>>>>>>>>> with
            MSVS 2010 and \Zp8 compiler option. On simple examples it<br>
            >>>>>>>>>>>>> seems
            to<br>
            >>>>>>>>>>>>> work
            properly.<br>
            >>>>>>>>>>>>> <br>
            >>>>>>>>>>>>> Is it
            interesting to the clang project?<br>
            >>>>>>>>>>>> We
            certainly want to fix any cases where clang does not do
            struct<br>
            >>>>>>>>>>>> layout
            consistently with MSVC on Windows.  It's hard to comment on<br>
            >>>>>>>>>>>> your patch
            without seeing it.<br>
            >>>>>>>>>>>> <br>
            >>>>>>>>>>>> -Eli<br>
            >>>>>>>>>>> Now I'm not at
            work. When I come to work I'll send a patch.<br>
            >>>>>>>>>>> <br>
            >>>>>>>>>>> - Dmitry<br>
            >>>>>>>>>> Here is patch for
            MSRecordLayoutBuilder.<br>
            >>>>>>>>> I think it would be
            better to integrate the checks into the main<br>
            >>>>>>>>> RecordLayoutBuilder
            class rather than subclassing it.<br>
            >>>>>>>>> <br>
            >>>>>>>>> Please include tests in
            your patch.  (See test/CodeGen/ms_struct.c for<br>
            >>>>>>>>> an example.)<br>
            >>>>>>>>> <br>
            >>>>>>>>> I would like someone
            more familiar with MSVC to review the actual<br>
            >>>>>>>>> logic here (ping me if
            nobody does within a few days, though, and I'll<br>
            >>>>>>>>> try to review anyway).<br>
            >>>>>>>>> <br>
            >>>>>>>>> -Eli<br>
            >>>>>>>> Ok, thanks for hint.<br>
            >>>>>>>> <br>
            >>>>>>>> -Dmitry.<br>
            >>>>>>> I have a problem when writing a
            test. Clang doesn't implement Microsoft<br>
            >>>>>>> ABI and he crashes at code
            generation stage.<br>
            >>>>>>> Clang have dump-record-layouts
            option but he prints AST layouts and<br>
            >>>>>>> CodeGen layouts.<br>
            >>>>>>> <br>
            >>>>>>> Is there a way to save only AST
            record layout to file and then check<br>
            >>>>>>> or maybe my patch must include
            CGRecordLayoutBuilder for Microsoft?<br>
            >>>>>> It would be easy enough to add a
            new testing switch if you'd like to get this in.<br>
            >>>>> Can you give me some hint how can I do
            this?<br>
            >>>> Follow the code for -dump-record-layouts.<br>
            >>> You propose to duplicate the output to a file
            and then run FileCheck to check output, am I right?<br>
            >> It would probably be better to run FileCheck
            directly on the output, but<br>
            >> I think you get the general idea.<br>
            >> <br>
            >> Whenever you get CGRecordLayoutBuilder working
            adequately, you can rip<br>
            >> out the new option and just use
            -dump-record-layouts.<br>
            >> <br>
            >> John.<br>
            > Ok, thanks. Tomorrow I'll do it.<br>
            > <br>
            Here is a test and patch.<br>
            <br>
            - Dmitry.<br>
            <br>
            <br>
            _______________________________________________<br>
            cfe-dev mailing list<br>
            <a moz-do-not-send="true"
              ymailto="mailto:cfe-dev@cs.uiuc.edu"
              href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
            <a moz-do-not-send="true"
              href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"
              target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
            <br>
            <br>
          </div>
        </div>
      </div>
    </blockquote>
    Hi,<br>
    what I get from MSVS output :<br>
    <br>
    class B    size(24):<br>
    1>      +---<br>
    1>   0    | {vfptr}<br>
    1>   8    | a<br>
    1>         | <alignment member> (size=4)<br>
    1>  16   | c<br>
    1>      +---<br>
    <br>
    And this I get from clang with my patch:<br>
       0 | class B<br>
       0 |   (B vtable pointer)<br>
       4 |   int a<br>
       8 |   double c<br>
      sizeof=16, dsize=16, align=8<br>
      nvsize=16, nvalign=8<br>
     <br>
    I'll try to fix this.<br>
    <br>
    What do you mean when you say "<span>Have you also tried test cases
      with and without constructors?</span>", can you give me some
    examples and I check them.<br>
    <br>
    - Dmitry.<br>
  </body>
</html>