[cfe-commits] [PATCH] Introduce a plugin architecture

Sean Silva silvas at purdue.edu
Mon Mar 5 11:30:34 PST 2012

Personally, I think that even with the gcc-like syntax, it is still too
burdensome to pass args. `-fplugin-arg-plugin-bar=baz` is a lot of typing
just for one arg. People just won't do that manually: they will write a
script to do it for them. That suggests that the best plan of action would
be to just write a simple python script that builds the command-line and
execs clang with the right args.

Usage would be:
clang-plugin++ ../../Debug+Asserts/lib/libPrintFunctionNames.so -w
--mylongopt=foo --some-arg -- -O3 -c file.cc -Wall
Any args after `--` are passed directly to clang as normal args.

This means that you can do `CXX=clang-plugin++ /path/to/plugin.so --foo -q
--` in a makefile and it will Just Work. It also adds a useful layer of
indirection which allows for more flexibility in changing how clang
actually processes the args.

--Sean Silva

On Mon, Mar 5, 2012 at 12:56 PM, Joshua Cranmer <pidgeot18 at gmail.com> wrote:

> To describe this patch in more detail:
> Basically, this implements what I discussed in the thread at
> <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-October/017972.html>.
> The most salient points:
> -fplugin=, -fplugin-arg-<name>-<arg>[=<value>] syntax for plugins
> (inspired from gcc's architecture)
> Specific function callbacks (plugin init, destroy, before, and after
> files are run), with a callback struct that allows to hook add
> PPCallback, ASTConsumer, and DiagonsticsClients on a per-file basis.
> --
> Joshua Cranmer
> News submodule owner
> DXR coauthor
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120305/034a6bf5/attachment.html>

More information about the cfe-commits mailing list