diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/RecordLayoutBuilder.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index c92116ac6c..3e413befd8 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -1483,13 +1483,21 @@ void RecordLayoutBuilder::LayoutFields(const RecordDecl *D) { uint64_t TypeSize = FieldInfo.first; unsigned FieldAlign = FieldInfo.second; // This check is needed for 'long long' in -m32 mode. - if (TypeSize > FieldAlign) + if (TypeSize > FieldAlign && + (Context.hasSameType(FD->getType(), + Context.UnsignedLongLongTy) + ||Context.hasSameType(FD->getType(), + Context.LongLongTy))) FieldAlign = TypeSize; FieldInfo = Context.getTypeInfo(LastFD->getType()); uint64_t TypeSizeLastFD = FieldInfo.first; unsigned FieldAlignLastFD = FieldInfo.second; // This check is needed for 'long long' in -m32 mode. - if (TypeSizeLastFD > FieldAlignLastFD) + if (TypeSizeLastFD > FieldAlignLastFD && + (Context.hasSameType(LastFD->getType(), + Context.UnsignedLongLongTy) + || Context.hasSameType(LastFD->getType(), + Context.LongLongTy))) FieldAlignLastFD = TypeSizeLastFD; if (TypeSizeLastFD != TypeSize) { @@ -1640,7 +1648,10 @@ void RecordLayoutBuilder::LayoutBitField(const FieldDecl *D) { unsigned FieldAlign = FieldInfo.second; // This check is needed for 'long long' in -m32 mode. - if (IsMsStruct && (TypeSize > FieldAlign)) + if (IsMsStruct && (TypeSize > FieldAlign) && + (Context.hasSameType(D->getType(), + Context.UnsignedLongLongTy) + || Context.hasSameType(D->getType(), Context.LongLongTy))) FieldAlign = TypeSize; if (ZeroLengthBitfield) { |