[cfe-dev] Converting a Clang tool that uses Libooling to a Clang plugin

Sandeep K Chaudhary babbusandy2006 at gmail.com
Mon Jul 14 20:07:10 PDT 2014


Hi Guys,

I have written a tool that uses Clang Libtooling, and performs some
instrumentation on the source code. It basically inspects all the
global defs in the AST and inserts the instrumentation code. The
original source files are over-written with the help of 'Rewriter'
class.

The tool reads the list of functions to instrument from an input file,
and also generates a couple of header files with the required
definitions for the instrumentation calls. It opens two o/p file
streams to write to the header files.

I wish to convert this tool to a Clang plugin so that I can use
command line options during the build process. This way, I won't have
to run the tool separately before building.

Can someone please let me know how easy/difficult is it going to be? I
hope that it is possible.

Thanks and regards,
Sandeep.



More information about the cfe-dev mailing list