[cfe-dev] RFC: Tree-based refactorings with Clang

Ilya Biryukov via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 26 02:00:06 PST 2019


On Mon, Feb 25, 2019 at 9:37 PM Jan Korous <jkorous at apple.com> wrote:

> Hi Ilya,
>
> This looks awesome!
>
> I am just curious - since the expected workflow is to always start with
> ASTMatchers do you plan to provide utilities to overcome limitations of AST
> you mention?

Syntax trees are actually independent of matchers, an input to build them
is a clang AST and one can find syntax tree nodes for the corresponding AST
nodes afterwards.
The matchers are just another way to find interesting AST nodes, so we can
use the same mechanism to map from the AST node (found by the matcher) to
the syntax tree node.

I guess the confusing part of the document was the FAQ section about
ASTMatchers, I've changed it to make it clear ASTMatchers are not planned
as the only input source.


> For example - do you plan to implement some functionality for separating a
> set of AST nodes based on their syntactic nature?
>
No plans to do this and it feels like building the syntax tree might be an
overkill to solve this. Intuition is that this should be solvable with a
switch on the AST node types.
That said, this is something that would definitely pop up while
implementing the syntax trees.

Thanks.
>
> Jan
>
>
> > On Feb 25, 2019, at 10:50 AM, Ilya Biryukov via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> >
> > Hi everyone,
> >
> > We would like to propose a new way of writing refactorings on top of the
> Clang infrastructure. Our is to have nice APIs that hide tedious tasks,
> like dealing with macros or adding parentheses around changed expressions.
> >
> > Design is discussed in detail here:
> >
> https://docs.google.com/document/d/161XftOcF-ut1pGQr5ci9kXd_y0jRQl3y9sVyvuEkLDc/edit?usp=sharing
> >
> > Please let us know what you think either by adding comments to the
> document or directly in this thread.
> > Eager to hear your thoughts!
> >
> > --
> > Regards,
> > Ilya Biryukov
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>

-- 
Regards,
Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190226/bb20a4c2/attachment.html>


More information about the cfe-dev mailing list