[cfe-dev] Late parsing of CXX11 attributes

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 27 03:15:50 PDT 2018


Wooh! Thanks for working on this.

Clang's `diagnose_if` attribute would certainly benefit from this change.
Currently it's usable only
as a GCC attribute.

I tried working on this a while back. IIRC the main issue is that C++11
attributes placed at the end of
a function declaration apply to the function type and not the declaration
itself. (See [dcl.spec]p1).

After discussing this with Richard and Aaron about attributes appearing
after a function-specifier, I believe the
consensus was to only apply the attribute to the type if said attribute is
a "type attribute". Otherwise the
attribute would apply to the entity being declared. For example, I think we
should accept `int foo() [[noreturn]];`

/Eric

On Wed, Jun 27, 2018 at 2:20 AM, Javier López via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> OK, unless Aaron replies that someone is currently implementing this, I
> will be working on a patch.
>
> I know :-) I have been working for months in the implementation of P0542
> in Clang. Late parsing is one of the missing features.
>
> El mar, 26-06-2018 a las 17:05 -0700, Richard Smith escribió:
>
> I'm not aware of anyone working on this (CC'd Aaron, who might know if
> someone is). Patches would be very much welcome :)
>
> Also relevant is http://wg21.link/p0542r5 (voted into the current C++
> working draft a couple of weeks ago), which requires late parsing for C++11
> attributes within a class.
>
> On 21 June 2018 at 04:16, Javier López via cfe-dev <cfe-dev at lists.llvm.org
> > wrote:
>
> Hello everyone,
>
> AFAIK, GNU attributes can be late parsed within a class (see
> ParseDecl.cpp, Parser::ParseGNUAttributes), but late parsing of CXX11
> attributes is not yet implemented.
>
> Is there any plans to do it or anyone already working on it? Anyway, if no
> one is owning that issue, I could work on it.
>
> Thanks,
> --
> Javier López
> 2.2.B.08 ARCOS lab, Computer Architecture Group
> University Carlos III of Madrid
> e-mail: jalopezg at inf.uc3m.es
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
> --
>
> Javier López
> 2.2.B.08 ARCOS lab, Computer Architecture Group
> University Carlos III of Madrid
> e-mail: jalopezg at inf.uc3m.es
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180627/30593001/attachment.html>


More information about the cfe-dev mailing list