LibTooling getting FixItWriter to work

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

LibTooling getting FixItWriter to work

Kristóf Umann via cfe-dev

I have been experimenting with libTooling for a while now. Looking at
the clang-tools sources I managed to get ASTFrontendActions,
ASTConsumer, ast_matchers, FixItHints, DiagnosticsEngines, etc. to work.

But I am stuck now with the clang::FixItRewriter class. Basically I want
to do a simple source-to-source translation. The InPlace option in the
clang::FixItOptions looks like the right thing to me. Then let the
Rewriter do the work via its method WriteFixedFiles();

I have been basically following Peter Goldsborough's blog post and his
presentations from

When I compile his minus-tool example, that rewrites any binary addition
expression (from 4 + 3 to 4 - 3), it works on my linux box either with
g++ 8.2.1 or with clang 7.0.0. However when I try my code, the
DiganosticsEngine shows the Warnings and associated FixItHints, but no
inplace rewriting is performed.

Any ideas on what to look out for?

Thanks a lot!
cfe-dev mailing list
[hidden email]