[PATCH] Microsoft Record Layout Required Alignment

Warren Hunt whunt at google.com
Wed Nov 27 15:26:52 PST 2013


Hi majnemer, rsmith, rnk,

Support MS-ABI's concept of "Required Alignment" imposed by __declspec(align())

This patch implements required alignment in a way that makes __declspec(align()) and #pragma pack play correctly together.  In the MS-ABI, __declspec(align()) is a hard rule and cannot be overridden by #pragma pack.  This cases each record to have two interesting alignments "preferred alignment" (which matches Itanium's concept of alignment) and "required alignment" which is an alignment that must never be violated, even in the case of #pragma pack.  This patch introduces the concept of Required Alignment to the record builder and tracks/uses it appropriately.  Test cases are included.

This patch should address the following bugs:
http://llvm.org/bugs/show_bug.cgi?id=18025
http://llvm.org/bugs/show_bug.cgi?id=18026

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

Files:
  include/clang/AST/RecordLayout.h
  lib/AST/RecordLayout.cpp
  lib/AST/RecordLayoutBuilder.cpp
  test/Layout/ms-x86-pack-and-align.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2283.1.patch
Type: text/x-patch
Size: 15717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131127/ace77201/attachment.bin>


More information about the cfe-commits mailing list