[cfe-dev] How to add a new rewriting option

Vincent R. forumer at smartmobili.com
Tue Jul 30 09:30:51 PDT 2013


Le 30.07.2013 17:47, jahanian a écrit :
> Hi Vincent,
>
> -rewrite-legacy-objc is out of date. For up to date support for
> ObjectiveC features and translation of its
> modern ABI, you may want to look into -rewrite-objc. -rewrite-objc 
> has
> simplified the workflow by pre-processing
> user program and translating it into C++. -rewrite-legacy-objc
> requires user to do the pre-processing step manually.
>

Ok but what I would like to achieve is closer to rewrite-legacy-objc 
than rewrite-objc
because I don't want to compile the code after transformation and I 
don't want preprocessing stage.


So now I have modified the Options.td for my new flag -rewrite-objc2cs 
and used the same parameters
as rewrite-legacy-objc but now the driver tells me : unrecognized

clang -rewrite-objc2cs NSButton.m -c -MMD -MP 
-DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"x86_64\" 
-DGNUSTEP_TARGET_OS=\"linux-gnu\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" 
-DBACKEND_BUNDLE=1 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 
-DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 
-fno-strict-aliasing -fexceptions -fobjc-exceptions 
-D_NATIVE_OBJC_EXCEPTIONS -fobjc-nonfragile-abi -D_NONFRAGILE_ABI 
-pthread -fPIC -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN 
-DGSDIAGNOSE -Wno-import -g -fgnu-runtime -Wall 
-fconstant-string-class=NSConstantString -I../Headers/Additions 
-I../Headers -I./. -I. -I/home/vincent/GNUstep/Library/Headers 
-I/GNUstep/Local/Library/Headers -I/GNUstep/System/Library/Headers 
-I/usr/include/libpng12


vincent at vincent-virtual-machine ~/objc2cs/gnustep/core/gui/Source $ 
clang -v -v -rewrite-objc2cs NSButton.m -c -MMD -MP 
-DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"x86_64\" 
-DGNUSTEP_TARGET_OS=\"linux-gnu\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" 
-DBACKEND_BUNDLE=1 -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 
-DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 
-fno-strict-aliasing -fexceptions -fobjc-exceptions 
-D_NATIVE_OBJC_EXCEPTIONS -fobjc-nonfragile-abi -D_NONFRAGILE_ABI 
-pthread -fPIC -DDEBUG -fno-omit-frame-pointer -Wall -DGSWARN 
-DGSDIAGNOSE -Wno-import -g -fgnu-runtime -Wall 
-fconstant-string-class=NSConstantString -I../Headers/Additions 
-I../Headers -I./. -I. -I/home/vincent/GNUstep/Library/Headers 
-I/GNUstep/Local/Library/Headers -I/GNUstep/System/Library/Headers 
-I/usr/include/libpng12
clang version 3.3 (186145)
Target: x86_64-unknown-linux-gnu
Thread model: posix
  "/opt/bin/clang-3.3" -cc1 -triple x86_64-unknown-linux-gnu 
-rewrite-objc2cs -disable-free -main-file-name NSButton.m 
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -relaxed-aliasing 
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables 
-fuse-init-array -target-cpu x86-64 -v -v -g -coverage-file 
/home/vincent/objc2cs/gnustep/core/gui/Source/NSButton.cs -resource-dir 
/opt/bin/../lib/clang/3.3 -dependency-file NSButton.d -MT NSButton.o -MP 
-D "GNUSTEP_TARGET_DIR=\".\"" -D "GNUSTEP_TARGET_CPU=\"x86_64\"" -D 
"GNUSTEP_TARGET_OS=\"linux-gnu\"" -D "LIBRARY_COMBO=\"gnu-gnu-gnu\"" -D 
BACKEND_BUNDLE=1 -D GNUSTEP -D GNUSTEP_BASE_LIBRARY=1 -D 
GNU_GUI_LIBRARY=1 -D GNU_RUNTIME=1 -D GNUSTEP_BASE_LIBRARY=1 -D 
_NATIVE_OBJC_EXCEPTIONS -D _NONFRAGILE_ABI -D DEBUG -D GSWARN -D 
GSDIAGNOSE -I ../Headers/Additions -I ../Headers -I ./. -I . -I 
/home/vincent/GNUstep/Library/Headers -I /GNUstep/Local/Library/Headers 
-I /GNUstep/System/Library/Headers -I /usr/include/libpng12 
-internal-isystem /usr/local/include -internal-isystem 
/opt/bin/../lib/clang/3.3/include -internal-externc-isystem 
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include 
-internal-externc-isystem /usr/include -Wall -Wno-import -Wall 
-fdebug-compilation-dir /home/vincent/objc2cs/gnustep/core/gui/Source 
-fconstant-string-class NSConstantString -ferror-limit 19 
-fmessage-length 159 -pthread -mstackrealign -fblocks 
-fobjc-runtime=gnustep-1.6 -fobjc-dispatch-method=non-legacy 
-fobjc-default-synthesize-properties -fno-objc-infer-related-result-type 
-fobjc-exceptions -fexceptions -fdiagnostics-show-option 
-fcolor-diagnostics -backend-option -vectorize-loops -o NSButton.cs -x 
objective-c NSButton.m
error: unknown argument: '-rewrite-objc2cs'

Before I use the same arguments as rewrite-legacy-objc, the command was 
working even if the result wasn't what I wanted to (non processed file).
So I suppose I forgot to add my new option somewhere in the code but I 
don't know where ...







More information about the cfe-dev mailing list