[cfe-dev] Adding a rewrite class to Clang

Jacob Carlborg doob at me.com
Sat Sep 18 05:36:10 PDT 2010


On 2010-09-17 09:30, Daniel Dunbar wrote:
> On Mon, Sep 13, 2010 at 2:10 AM, Jan Bierbaum
> <s3306700 at inf.tu-dresden.de>  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.
>
> Note that this is no longer true, the option parser tblgen backend
> handles the reordering now.
>
>   - Daniel

Ok, then I guess I used an older version of Clang.

>>
>>> 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.
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>


-- 
/Jacob Carlborg




More information about the cfe-dev mailing list