[cfe-dev] AST matcher for C++11 [[attributes]]

Andrzej Krzemienski via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 3 03:12:57 PST 2017


2017-02-02 14:54 GMT+01:00 Aaron Ballman <aaron at aaronballman.com>:

> On Thu, Feb 2, 2017 at 7:33 AM, Andrzej Krzemienski via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> >
> >
> > Aaron, thanks for the reply. However it seams I phrased my question
> > incorrectly. I would like to check the existence of my own unique
> attribute,
> > say [[ab::cd::my_attribute]]. It is not in the list of any known
> attributes.
> > hasAttr() appears to only detect the known attributes that are already
> > listed in the long attribute enum. But will not see a new attribute.
> >
> > So my question is, in clang-tidy is it possible to inspect custom
> > attributes, like [[ab::cd::my_attribute]] ?
>
> If your custom attribute is implemented by adding the attribute to
> Attr.td, then it should work fine (depending on your attribute
> definition). The list of known attributes used by hasAttr() is
> automatically generated from the attributes listed in Attr.td, and the
> only attributes that don't get enumerated are ones which do not have
> an AST node associated with them.
>
> If your attribute is not added to Attr.td, then you are correct,
> clang-tidy has no knowledge of it.
>

Thanks for a detailed. Response. I will try it out.

Regards,
&rzej;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170203/32e48373/attachment.html>


More information about the cfe-dev mailing list