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

Andrzej Krzemienski via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 2 04:33:06 PST 2017


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

> On Mon, Jan 23, 2017 at 6:13 AM, Andrzej Krzemienski via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> > Hi everyone,
> > I am not sure of this is the right list. I have an issue with
> clang-tidy's
> > predefined AST Matchers. The documentation for using clang-tidy
> > (http://clang.llvm.org/extra/clang-tidy/) suggests that one should
> first try
> > to use of predefined matchers listed in
> > http://clang.llvm.org/docs/LibASTMatchersReference.html.
> >
> > But there is no matcher for C++11 [[attributes]]. There is matcher
> hasAttr,
> > but it only works for predefined GCC __attribute__((s)).
>
> The hasAttr() matcher works for all attributes based on the Attr::Kind
> enumeration. This will not distinguish between different spellings of
> the same attribute, but that should (hopefully) be largely irrelevant.
> So this matcher should do what you need already.
>

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]] ?

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


More information about the cfe-dev mailing list