[cfe-commits] [PATCH] c++11 type attribute fix

Eli Friedman eli.friedman at gmail.com
Tue Oct 23 14:07:40 PDT 2012


On Mon, Oct 22, 2012 at 9:40 AM, Michael Han <Michael.Han at autodesk.com> wrote:
> Ping with updated patch against TOT.
>
> Michael
> -----Original Message-----
> From: Michael Han
> Sent: Thursday, October 18, 2012 11:48 AM
> To: 'cfe-commits at cs.uiuc.edu'
> Subject: [PATCH] c++11 type attribute fix
>
> Hi,
>
> This patch enables Clang to apply C++11 attributes present after declaration specifiers to types instead of declarators, and warn on attributes that appear at wrong place (like carries_dependency which can't be applied to types). Please review, thanks!

+      if (isDeclSpec && declSpecLoc.isValid() && declSpecLoc < attr.getLoc())

You can't use "<" on source locations like this; it provides an
ordering, but that ordering isn't source order.

More generally, the whole "try to apply to a type, fall back to a
decl" thing is specific to gcc attribute syntax; we shouldn't be doing
that for C++11 attributes regardless of whether the attribute in
question is defined in the C++11 standard.

-Eli



More information about the cfe-commits mailing list