[cfe-dev] extending Clang

Sean Silva silvas at purdue.edu
Sun Feb 26 20:58:53 PST 2012


It's a little more complicated than that, I'm afraid. PrintFunctionNames is
a plugin, so it doesn't get compiled inside clang; you have to pass command
line arguments to clang to tell it where to find the plugin and to load it.
There's a minimal tutorial for how to do something very similar to what you
want here <https://github.com/chisophugis/clang_plugin_example>.

The key thing is the program `invocation_builder.py` which generates
command line arguments that will cause clang to load the plugin. Then you
will just need to add those arguments to CFLAGS or CXXFLAGS in your
makefile.

Btw if you find anything lacking in that example plugin or not well
explained, please let me know! I'm trying to improve it so that it is as
understandable as possible.

--Sean Silva

On Sun, Feb 26, 2012 at 11:22 PM, akshay ratnaparkhi <ackk007 at gmail.com>wrote:

> I am trying to print the function names in the input c or c++ file. I
> wrote a code for that having class 'PrintFunctionNames'. Now I want to
> build that code with the clang's source code and when I compile the c or
> c++ input file with 'clang ' command my code should be automatically
> execute with compilation and prints the function names. means I want to
> write the driver option like -o,-c etc to run my code. How can I do that?
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120226/94a24f5b/attachment.html>


More information about the cfe-dev mailing list