From: Warren Hunt Date: Tue, 29 Oct 2013 23:49:26 +0000 (+0000) Subject: Fixing code gen to handle microsoft layouts for which size % alignment X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f600171fdd68568507a77291637dd5173dd0885;p=clang Fixing code gen to handle microsoft layouts for which size % alignment != 0 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193661 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index d7d214fd7e..e67f517e1e 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -203,6 +203,9 @@ public: void CGRecordLayoutBuilder::Layout(const RecordDecl *D) { Alignment = Types.getContext().getASTRecordLayout(D).getAlignment(); Packed = D->hasAttr(); + const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D); + if (Layout.getSize() % Layout.getAlignment() != 0) + Packed = true; if (D->isUnion()) { LayoutUnion(D);