[cfe-dev] LibTooling getting FixItWriter to work
Uli Laube via cfe-dev
cfe-dev at lists.llvm.org
Mon Nov 26 10:26:07 PST 2018
Hi!
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
https://github.com/peter-can-talk/cppnow-2017
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!
Uli
More information about the cfe-dev
mailing list