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

Vincent R. forumer at smartmobili.com
Sun Jul 28 05:31:26 PDT 2013


Le 28.07.2013 12:24, Vincent R. a écrit :
> Hi,
>
> I would like to make some test about converting some objc code into 
> C#
> So I have started to locate the code responsible to handle
> objc-rewrite and I tried to do the same for my case.
> Presently I just want have something that compiles so I have
> duplicated RewriteObjC.cpp and renamed it into RewriteObjC2Cs.cpp
> and changed the class name (I didn't include it inside the diff below
> because it makes things hard to read).
> So now when I compile I get the following error :
>
>
> Scanning dependencies of target clangFrontend
> [ 84%] Building CXX object
> 
> tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInstance.cpp.o
> 
> /home/vincent/objc2cs/clang/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:
> In member function ‘bool
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)’:
> 
> /home/vincent/objc2cs/clang/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:665:43:
> error: ‘RewriteObjC2Cs’ is not a member of ‘clang::frontend’
> make[2]: ***
> 
> [tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInstance.cpp.o]
> Error 1
> make[1]: ***
> [tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/all] Error 2
> make: *** [all] Error 2
>
> What am I missing ?
>
Actually I think I found I forgot to add the corresponding enum inside 
FrontendOptions.h :

Index: tools/clang/include/clang/Frontend/FrontendOptions.h
===================================================================
--- tools/clang/include/clang/Frontend/FrontendOptions.h	(revision 
186145)
+++ tools/clang/include/clang/Frontend/FrontendOptions.h	(working copy)
@@ -51,6 +51,7 @@
      PrintPreprocessedInput, ///< -E mode.
      RewriteMacros,          ///< Expand macros but not \#includes.
      RewriteObjC,            ///< ObjC->C Rewriter.
+    RewriteObjC2Cs,         ///< ObjC->C# Rewriter.
      RewriteTest,            ///< Rewriter playground
      RunAnalysis,            ///< Run one or more source code analyses.
      MigrateSource,          ///< Run migrator.







More information about the cfe-dev mailing list