Clang Rewriter or clang refactor tool


I wish to use the clang rewriter or appropriate refactoring tool to do the following:


std::vector<int> fred[10];
fred[10] = 12;


std::vector<int> fred[10]; = 12;

Now, all the clang rewriter examples I have seen only contain very simple examples, or just renaming a variable or something simple like that.

Are there any more complex examples out there that I might use to get some way to doing the above rewrite.
I don’t even know what the above rewrite would be called. Maybe “convert array syntax to .at() syntax”

Another rewrite example I am looking for is a way to automatically convert a “printf()” format string to a “fmt::format()” string.

Is the a central repository where anyone who has written a clang rewrite method can post, so that others might re-use it.

Is clang-rewrite the tool to use here, or is there now a more capable clang-refactor tool out there?

Also, the reason to use a rewriter / refactoring tool is that there needs to be some reasoning around it.
For example,
a[10] = 12;
can only be rewritten as: = 12;
if a is a vector. If a is a C array, it should not be changed.

The future more complex feature might eventually be able to refactor a C array into a std::vector, with also updating all the C array mallocs etc. and for loops with limits for size to std::vector initialisers and accessors, e.g. push_back() and .size() etc.