[cfe-dev] Adding a rewrite class to Clang

Jacob Carlborg doob at me.com
Sat Sep 18 05:37:32 PDT 2010


On 2010-09-13 11:10, Jan Bierbaum wrote:
> Hi Jacob!
>
> Jacob Carlborg meinte am 12.09.2010 22:30:
>
>> <FlagClass Name:"-rewrite-objc">
>> <FlagClass Name:"-rewrite-objc-to-d">
>> Assertion failed: (0&&  "Options are not in order!"), function OptTable,
>> file OptTable.cpp, line 119.
> [...]
>> So how do I correctly add a new command line option to Clang
>
> You just have to order them correctly [1]:
>
> | Options are stored in sorted order, with '\0' at the end of the
> | alphabet.o
>
> So '-rewrite-objc-to-d' has to come *before* '-rewrite-objc'. The
> ordering is necessary due to the way Clang parses its options.

Thanks that helped, but how could "-rewrite-objc-to-d" come before 
"-rewrite-objc" ?

>> or is there a better way to quickly get up and running with a new
>> rewrite class?
>
> You could implement it as a plugin. There's an example in
> 'example/PrintFunctionNames'. Unfortunately the plugin infrastructure is
> somewhat buggy/incomplete/?, so you have to add a minor change to llvm
> before they work [2].
>
>
> [1] http://clang.llvm.org/doxygen/OptTable_8cpp_source.html#l00201
> [2] http://permalink.gmane.org/gmane.comp.compilers.clang.devel/8277
>
>
> Regards, Jan.


-- 
/Jacob Carlborg




More information about the cfe-dev mailing list