[llvm-dev] How to use clang::tooling::Transformer?

Dobby HouseElf via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 13 13:47:49 PDT 2021


Hello everyone,
I am looking into source-to-source translation with LLVM. 
I found a tutorial but it looks out-of-date (~7 years old) - https://eli.thegreenplace.net/2014/05/01/modern-source-to-source-transformation-with-clang-and-libtooling/
One of the latest answers regarding the same topic in this mailing pointed to 'Transformer' class. The 'RewriteRule' looks similar to ASTMatcher, except the 'changeTo' part - which is static - can it be made dynamic? (different replacement for each match). I couldn't understand how to construct 'ChangeConsumer' object to instantiate a 'Transformer'-based tool.I couldn't find any example or tutorial on how to use this interface with a stand-alone tool. Any pointer to documentation?
Thanks in advance!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210713/47a13511/attachment.html>


More information about the llvm-dev mailing list