[cfe-dev] clang plugins
Francois de Ferriere
francois.de-ferriere at st.com
Wed Jan 29 05:05:55 PST 2014
Hi,
I am using clang as a front-end to llvm to generate code for a target
processor.
I would like to use the clang plugin mechanism to pass some
information to the compiler during the front-end pass, and then continue
the flow down to the code generation.
As I saw in several examples, a plugin must derive from the class
"PluginASTAction", and the function CreateASTConsumer has to be defined
to produce a consumer. However, this consumer replaces the consumer that
the front-end uses to call the backend, thus canceling the code
generation when a plugin is used.
I finally managed to do what I want by recreating the
BackendConsumer in the CreateASTConsumer function of my plugin, but this
requires duplicating some code from the front-end, and it looks like a
hack.
Is there a cleaner way to do what I need, or is there another
mechanism than the plugins to do this ?
Best regards,
- François.
More information about the cfe-dev
mailing list