r193661 - Fixing code gen to handle microsoft layouts for which size % alignment
Warren Hunt
whunt at google.com
Tue Oct 29 16:49:26 PDT 2013
Author: whunt
Date: Tue Oct 29 18:49:26 2013
New Revision: 193661
URL: http://llvm.org/viewvc/llvm-project?rev=193661&view=rev
Log:
Fixing code gen to handle microsoft layouts for which size % alignment
!= 0
Modified:
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=193661&r1=193660&r2=193661&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Tue Oct 29 18:49:26 2013
@@ -203,6 +203,9 @@ public:
void CGRecordLayoutBuilder::Layout(const RecordDecl *D) {
Alignment = Types.getContext().getASTRecordLayout(D).getAlignment();
Packed = D->hasAttr<PackedAttr>();
+ const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
+ if (Layout.getSize() % Layout.getAlignment() != 0)
+ Packed = true;
if (D->isUnion()) {
LayoutUnion(D);
More information about the cfe-commits
mailing list