[llvm-commits] [patch] AlignAs fixes

Chandler Carruth chandlerc at gmail.com
Fri Sep 14 15:24:39 PDT 2012


LGTM


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120914/edaaf635/attachment.html>


More information about the llvm-commits mailing list