[llvm-commits] [patch] AlignAs fixes

David Blaikie dblaikie at gmail.com
Fri Sep 14 15:27:58 PDT 2012


On Fri, Sep 14, 2012 at 3:24 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> LGTM

Thanks. Committed as r163944

>
>
> On Fri, Sep 14, 2012 at 1:27 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> Ping.
>>
>> On Tue, Sep 4, 2012 at 5:26 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> > Ping.
>> >
>> > On Wed, Aug 29, 2012 at 8:56 AM, David Blaikie <dblaikie at gmail.com>
>> > wrote:
>> >> Updated based on feedback from IRC. Updated some comments, made Clang
>> >> use the standard feature rather than the __attribute__, removed some
>> >> unused template definitions.
>> >>
>> >> On Tue, Aug 28, 2012 at 3:56 PM, David Blaikie <dblaikie at gmail.com>
>> >> wrote:
>> >>> Here's an attempt to fix the incorrect/non-portable code in AlignAs.h
>> >>> and its unit test.
>> >>>
>> >>> We were previously trying to align typedefs, which isn't valid in
>> >>> C++11. Even attempting to use alignas correctly won't work on any
>> >>> compiler other than Clang anyway, even those (such as GCC 4.7)
>> >>> reporting C++11 compliance through the __cplusplus macro value.
>> >>>
>> >>> So instead:
>> >>> for __GNUC__, use __attribute__((aligned(x))) of a char
>> >>> for __cplusplus == 201103L || __has_feature(cxx_alignas), use alignas
>> >>> on a char (this code path isn't actually tested at the moment since
>> >>> clang reports __GNUC__ so it hits the first case)
>> >>> for _MSC_VER, use __declspec(align(x)) on a char
>> >>>
>> >>> This doesn't try to align a typedef as we were doing before, so I cut
>> >>> a few test cases & extra types out of the test file - this doesn't
>> >>> change the implementation much because we were stuffing a variable of
>> >>> the typedef'd type in an anonymous struct anyway - so now we just use
>> >>> the template with the aligned member directly.
>> >>>
>> >>> Yes/no/maybe? (I haven't actually looked at the code to see if this is
>> >>> producing correct code - just updated the test cases fairly
>> >>> mechanically & checked that they pass)
>> >>>
>> >>> - David
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list