summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayoutBuilder.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-05-06 22:42:22 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-05-06 22:42:22 +0000
commit307eace474200837ed45b15e4a2d30a930e8de78 (patch)
tree5c11b1d8494da77a688d0123f5d1fd2bf7562403 /clang/lib/AST/RecordLayoutBuilder.cpp
parentbcabcdcedd2cef9a93f3fcfba3f5f103ce4f0813 (diff)
downloadbcm5719-llvm-307eace474200837ed45b15e4a2d30a930e8de78.tar.gz
bcm5719-llvm-307eace474200837ed45b15e4a2d30a930e8de78.zip
In ms_struct structs, Establish a new alignment for a
non-bitfield following a bitfield if size of their types differ. llvm-svn: 131032
Diffstat (limited to 'clang/lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r--clang/lib/AST/RecordLayoutBuilder.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 49c3b585109..4466be6ca23 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1269,15 +1269,19 @@ void RecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
// ignored:
else if (Context.ZeroBitfieldFollowsNonBitfield(FD, LastFD))
continue;
+ // FIXME. streamline these conditions into a simple one.
else if (Context.BitfieldFollowsBitfield(FD, LastFD) ||
- Context.BitfieldFollowsNoneBitfield(FD, LastFD)) {
- // Adjacent bit fields are packed into the same 1-, 2-, or
+ Context.BitfieldFollowsNoneBitfield(FD, LastFD) ||
+ Context.NoneBitfieldFollowsBitfield(FD, LastFD)) {
+ // 1) Adjacent bit fields are packed into the same 1-, 2-, or
// 4-byte allocation unit if the integral types are the same
// size and if the next bit field fits into the current
// allocation unit without crossing the boundary imposed by the
// common alignment requirements of the bit fields.
- // Also, establish a new alignment for a bitfield following
+ // 2) Establish a new alignment for a bitfield following
// a non-bitfield if size of their types differ.
+ // 3) Establish a new alignment for a non-bitfield following
+ // a bitfield if size of their types differ.
std::pair<uint64_t, unsigned> FieldInfo =
Context.getTypeInfo(FD->getType());
uint64_t TypeSize = FieldInfo.first;
OpenPOWER on IntegriCloud