]> granicus.if.org Git - clang/commit
Support MS-ABI's concept of "Required Alignment" imposed by
authorWarren Hunt <whunt@google.com>
Fri, 6 Dec 2013 00:01:17 +0000 (00:01 +0000)
committerWarren Hunt <whunt@google.com>
Fri, 6 Dec 2013 00:01:17 +0000 (00:01 +0000)
commit5ec042b219241ea73f33a143a0e5735c2f57886b
tree41a962cb129ea99b26781df6c7a43207178e21d1
parentb5d65e84c9b9f5e9e059ae5c30dd1a3b37c4246f
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.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196549 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/RecordLayout.h
lib/AST/RecordLayout.cpp
lib/AST/RecordLayoutBuilder.cpp
test/Layout/ms-x86-pack-and-align.cpp [new file with mode: 0644]