<div>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.</div>
<div><br></div><div>Usage would be:</div><div>clang-plugin++ <span style="background-color:rgb(255,255,255);font-family:arial,sans-serif;font-size:12px">../../Debug+Asserts/lib/</span><span style="background-color:rgb(255,255,255);font-family:arial,sans-serif;font-size:12px">libPrintFunctionNames.so -w --mylongopt=foo --some-arg -- -O3 -c file.cc -Wall</span></div>
<div><font face="arial, sans-serif">Any args after `--` are passed directly to clang as normal args.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">This means that you can do `CXX=</font>clang-plugin++ /path/to/plugin.so<span style="background-color:rgb(255,255,255);font-size:12px;font-family:arial,sans-serif"> --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.</span></div>
<div><br></div><div><div>--Sean Silva<br><br><div class="gmail_quote">On Mon, Mar 5, 2012 at 12:56 PM, Joshua Cranmer <span dir="ltr"><<a href="mailto:pidgeot18@gmail.com">pidgeot18@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
To describe this patch in more detail:<br>
Basically, this implements what I discussed in the thread at<br>
<<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-October/017972.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-October/017972.html</a>>.<br>
The most salient points:<br>
<br>
-fplugin=, -fplugin-arg-<name>-<arg>[=<value>] syntax for plugins<br>
(inspired from gcc's architecture)<br>
Specific function callbacks (plugin init, destroy, before, and after<br>
files are run), with a callback struct that allows to hook add<br>
PPCallback, ASTConsumer, and DiagonsticsClients on a per-file basis.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Joshua Cranmer<br>
News submodule owner<br>
DXR coauthor<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>