[cfe-dev] clang driver -- pre-preprocessing job/function
david.mcnamara at crescentbaysoftware.com
Tue Aug 3 18:22:15 CDT 2010
I've spent the last couple of hours looking at the clang-driver and am
about to try and make some changes -- I have a fair amount of confidence
that I can get done what I need to get done but I want to make sure I
really use the clang-driver framework rather than just a hack to get the
What I need to do is the following:
If a certain command line argument is present, then do a special
pre-preprocessing job (actually, replacing the preprocessor with my own
I believe I should add this argument in
~tools/clang/include/clang/Driver/Options.td -- perhaps adding a special
"OptionGroup" type or just using the CompileOnly_Group (a special option
group might help identify that the special arg is present and to be able
to delete it later after my special preprocessing job)
When this argument is present -- I need to pass the preprocessing
arguments (-D, -I,.. ) and my special arguments to a new job (could
actually be a linked in call) -- when that job is finished, I
essentially want to continue the compilation process as it was requested
(compilation only, linking, etc...) only eliminating my special-args.
This special preprocessing would only occur when some compilation is to
be done (source files are present) and the result would be replacing the
source-files with the modified preprocessor name.
I'm thinking these steps should either be added in BuildCompilation of
At least one other alternative would be to do the special preprocessing
right when the actual "normal" preprocessing is done... either by a
library call or with ExecuteCommand (not sure which is preferable).
Might be the cleanest way since I essentially just have to replace the
normal-preprocessor with my preprocessor (haven't found the function for
It looks like another way to do it would be through "requested plugins" (?)
Not sure which implementation path to take -- any suggestions?
More information about the cfe-dev