[cfe-commits] [patch] -add-plugin

Nico Weber thakis at chromium.org
Sun Jan 23 12:43:30 PST 2011


Here is a proof-of-concept ctags plugin in ~200 non-comment lines made
possible by this patch: http://codepad.org/CjvHUEkG
With this -add-plugin flag, it is trivial to run this plugin on large
code bases such as llvm/clang itself, while the normal build process
takes place.

(http://codepad.org/Gwr9bDWR can be used to convert the resulting
sqlite database into a tags file in the exuberant ctags format, which
can be read by e.g. vim)

While writing this demo, I realized that -plugin-arg does not work for
plugins added by -add-plugin. If you think this is a good change, I
will fix -plugin-arg for add-plugins in a follow-up change.

Nico

On Fri, Jan 21, 2011 at 1:48 PM, Nico Weber <thakis at chromium.org> wrote:
> Hi,
>
> the current -plugin flag swaps out codegen for a different plugin. I'd
> like to able to run plugins in addition to codegen. The attached patch
> adds support for -add-plugin, which does just that.
>
> With this, it's for example very easy to run a plugin that dumps all
> toplevel declarations to a file while building by just setting
> CFLAGS="-Xclang -load -Xclang path/to/my/plugin.so -Xclang -add-plugin
> -Xclang myplugin" and using the normal build system of one's project
> (say, make or xcodebuild) – one can write a ctags program that
> supports c++ in just a few lines of code.
>
> If the flag is not present, the patch doesn't modify the current flow
> at all. And changes to existing files are small.
>
> Nico
>




More information about the cfe-commits mailing list