[cfe-dev] How to add an option to clang

Jacob Carlborg doob at me.com
Sun Nov 6 12:34:48 PST 2011


On 2011-11-05 05:41, redder_0210 wrote:
> Dear All,
> I'm trying to add a command line option to Clang/Clang++.I want to let
> clang do the actions coresponding to the new command option.
> What I have done is that I have modified the driver of Clang, including
> the "Dirver.cpp" ,"options.td", "Tools.cpp" and "Action.cpp".
> But the compilation instance( namely Clang cc1) of Clang cannot identify
> the new option. And the console prints the ERROR:" unsupported
> argumnet". Perhaps, I should modified the Clang cc1 to make it be albe
> to accept the new option. But I don't know how to deal with the "Clang cc1".
> what's more, when I have add the new command line argumnet to the
> "CC1Options.td", the console prints the "ast infomation"(in my opinion)
> of the source File. I have no idea about the reason.
> Thanks in advance.
> ----Redder.
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

I can recommend doing a global search of all Clang files for an existing 
option, try the one for Objective-C rewriting. Then you can see all the 
files you need to change to add new option.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list