[cfe-dev] A plugin proposal for clang

David Chisnall csdavec at swan.ac.uk
Mon Oct 17 07:38:42 PDT 2011


On 17 Oct 2011, at 15:34, John Criswell wrote:

> On 10/15/11 3:44 AM, David Chisnall wrote:
>> On 15 Oct 2011, at 01:31, Joshua Cranmer wrote:
>> 
>>> 	• Custom optimization passes
>> These are more likely to be LLVM plugins than clang plugins.  We already have a mechanism for optimisation plugins to automatically insert themselves into the optimiser chain - I'm using this for some Objective-C optimisations.
> 
> Is there currently a way to do that based on compiler flags?  For SAFECode, we added a -fmemsafety flag to enable/disable the transforms that add memory safety checks.  Being able to write a plugin for Clang that adds command-line options that can enable new transformation passes would alleviate our need to copy Clang into the SAFECode project.

You can do -Xclang -load -Xclang /path/to/plugin.so.  This is pretty ugly though.  I'd love to see this improved, but it keeps getting pushed down my TODO list...

David



More information about the cfe-dev mailing list