[cfe-dev] Adding a rewrite class to Clang
Jacob Carlborg
doob at me.com
Sun Sep 12 13:30:21 PDT 2010
Hi
My goal is to create a source to source translator that translates
Objective-C header files into D files. From what I've read here in this
list I should create a rewrite class, something like RewriteObjC.cpp.
I started by modifying RewriteObjC.cpp but then thought that it would be
better to add a new rewrite class. I modified the source code for Clang
and added a new file called RewriteObjCToD.cpp by copying the existing
RewriteObjC.cpp then I added a new command line option to Clang to be
able to use the new rewrite class. After compiling everything I tried to
run Clang using "clang --help" and got this error:
<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.
0 clang 0x00000001013764c2 PrintStackTrace(void*) + 34
1 clang 0x0000000101377163 SignalHandler(int) + 707
2 libSystem.B.dylib 0x000000010206435a _sigtramp + 26
3 libSystem.B.dylib 0x0000000102400000 _sigtramp + 3783872
4 clang 0x000000010001e9d2 __assert_rtn + 66
5 clang 0x00000001000aebec
clang::driver::OptTable::OptTable(clang::driver::OptTable::Info const*,
unsigned int) + 780
6 clang 0x00000001000a8a7a
clang::driver::createDriverOptTable() + 42
7 clang 0x000000010009f6ef
clang::driver::Driver::Driver(llvm::StringRef, llvm::StringRef,
llvm::StringRef, bool, bool, clang::Diagnostic&) + 111
8 clang 0x0000000100025e90 main + 1360
9 clang 0x000000010001eca8 start + 52
Stack dump:
0. Program arguments: ./clang --help
Illegal instruction
So how do I correctly add a new command line option to Clang or is there
a better way to quickly get up and running with a new rewrite class?
--
/Jacob Carlborg
More information about the cfe-dev
mailing list