[PATCH] Microsoft C++ Record Layout

Warren Hunt whunt at google.com
Wed Jul 10 16:35:13 PDT 2013


  Here's an update that contains everything associated with C++ record layout and a pile of test cases for validation.  A few things to note:
  * It's still in two files and doesn't use CRTP.  The net overlap between the current record builder and this one is 7 member variables, 1 typedef and 10 functions with the same names but different functionality.  The closest functionality is laying out fields (non-bit-fields) but it rounds in a slightly different place and is only a few lines of code.  Basically although in spirit the ms and non-ms builders achieve similar goals, they do so in completely different ways.  I would use an analogy of implementing a dictionary using a B-tree or a red-black tree.  They may both implement a dictionary using a tree but don't actually have much of any share-able code.
  * Currently, there exists classes for which CGRecordLayoutBuilder can't handle and will trip an assert.  Such classes exist in the currently checked in code:http://llvm.org/bugs/show_bug.cgi?id=16459
  but this patch causes some in the existing ms_class_layout lit test and at least one other.  I'll need to fix CGRecordLayoutBuilder and will likely have questions.  This issue should be addressed before the patch lands, hopefully before I leave for a conference/paternity leave late next week...
  * I have not yet ripped out the current references to IsMsStruct but will do so as soon as I get CGRecordLayoutBuilder patched in such a way I can run check-clang successfully.  I don't see any difficulty there.

Hi rnk, rsmith,

http://llvm-reviews.chandlerc.com/D1026

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1026?vs=2578&id=2760#toc

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/RecordLayout.h
  include/clang/Sema/Sema.h
  lib/AST/CMakeLists.txt
  lib/AST/MicrosoftRecordLayoutBuilder.cpp
  lib/AST/RecordLayout.cpp
  lib/AST/RecordLayoutBuilder.cpp
  lib/Sema/SemaDecl.cpp
  test/Layout/ms-x86-aligned-tail-padding.cpp
  test/Layout/ms-x86-basic-layout.cpp
  test/Layout/ms-x86-empty-nonvirtual-bases.cpp
  test/Layout/ms-x86-empty-virtual-base.cpp
  test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp
  test/Layout/ms-x86-primary-bases.cpp
  test/Layout/ms-x86-size-alignment-fail.cpp
  test/Layout/ms-x86-vfvb-alignment.cpp
  test/Layout/ms-x86-vfvb-sharing.cpp
  test/Layout/ms-x86-vtordisp.cpp
  test/Sema/ms_bitfield_layout.c
  test/Sema/ms_class_layout.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1026.4.patch
Type: text/x-patch
Size: 135264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130710/72d2a375/attachment.bin>


More information about the cfe-commits mailing list