On Tue, Oct 29, 2013 at 4:57 PM, David Blaikie <[email protected]> wrote:
>
> On Tue, Oct 29, 2013 at 4:49 PM, Warren Hunt <[email protected]> wrote:
>
>> 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
>>
>
> Test case?
>
>
>>
>>
>> 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);
>>
>
You can reuse the ASTRecordLayout lookup from the alignment check. I think
it's a DenseMap lookup, which is worth saving.
> + if (Layout.getSize() % Layout.getAlignment() != 0)
>> + Packed = true;
>>
>> if (D->isUnion()) {
>> LayoutUnion(D);
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> [email protected]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits