[cfe-dev] RFC: Easier AST Matching by Default

Allyn Shell via cfe-dev cfe-dev at lists.llvm.org
Mon May 25 19:52:30 PDT 2020


Stephen,

Thank you for your post. It is not completely clear if this was a response to my post or simply happened to be after my post in the cfe-dev Digest. Either way, I want to keep in touch because this appears to answer my need.

In addition, I am writing some support tools to facilitate the creation of new compilers or programming languages. I planned to do this to support my course development, and it appears that they will connect with your activities well. Please keep in touch.

Blessings,
Allyn Shell

Date: Mon, 25 May 2020 00:24:57 +0100
From: Stephen Kelly via cfe-dev <cfe-dev at lists.llvm.org>
To: cfe-dev <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] RFC: Easier AST Matching by Default
Message-ID: <46b88e09-b58f-be80-bbcc-91907ee7d90e at gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
On 20/12/2019 21:01, Stephen Kelly via cfe-dev wrote:
>
> Hi,
>
> (Apologies if you receive this twice. GMail classified the first one as
> spam)
>
> Aaron Ballman and I met by chance in Belfast and we discussed a way
> forward towards making AST Matchers easier to use, particularly for C++
> developers who are not familiar with the details of the Clang AST.
>
> For those unaware, I expanded on this in the EuroLLVM conference this
> year, and then expanded on it at ACCU:
>
>   https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
>
> One step in the process of getting there is changing the default
> behavior of AST Matchers to ignore invisible nodes while matching using
> the C++ API, and while matching and dumping AST nodes in clang-query.
>
> I think this is the most important change in the entire proposal as it
> sets out the intention of making the AST Matchers easier to use for C++
> developers who are not already familiar with Clang APIs.
>
> To that end, I've written an AST to motivate the change:
>
>
> https://docs.google.com/document/d/17Z6gAwwc3HoRXvsy0OdwU0X5MFQEuiGeSu3i6ICOB90
>
>
> We're looking for feedback before pressing forward with the change. I
> already have some patches written to port clang-tidy and unit tests to
> account for the change of default.


This change is now in master.

clang-query has also been updated to allow setting the traversal mode. eg:

   set traversal AsIs

Since the original RFC I also added clang-query support to godbolt.org,
so you can experiment with it there instead of my personal instance of
compiler-explorer:

   https://gcc.godbolt.org/z/uwTgZS

If anyone watched my talk from EuroLLVM linked in my blog above, I am
interested in feedback to know which feature I presented there you would
most like to see upstreamed.

Thanks,

Stephen.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200526/a8b9c336/attachment.html>


More information about the cfe-dev mailing list