[cfe-dev] clang-refactor usage and development

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Sat Aug 25 02:48:38 PDT 2018


Hello everyone,

I am currently looking into adding new refactorings for clang to utilize
them both in clang-tidy and clang-refactor.

While exploring clang-refactor it seemed, that the tool itself does not
work yet on standalone files, but only for the existing test cases. But
the code for the tool itself does contain logic to actually apply
refactorings inplace or to print the new file to stdout.

Given that clang-refactor still seems to be in an unstable stage, could
someone point me to the right places to make it work as standalone tool?
I would be very interested to get it running and maybe write a
vim-integration similar to clang-rename as well.


Background:

For me it would be very valuable to add the refactoring to a central
place within clang, as I want to extend some of the clang-tidy checks to
do more code transformations which relies sometimes on prior
refactorings. For example to change the const-ness of a variable it is
necessary to isolate the variable declaration first and change the type
second.

Transforming `int a, b, c = 0;` into `int a; int b; int c = 0;` is the
refactoring i am implementing at the moment as well. But my code runs
within clang-tidy as I was able to experiment better with it.


Thank you for the help.

All the best

Jonas




More information about the cfe-dev mailing list