Hello,
i've written a plugin for clang, which i want to use in my compilation
process. What
i want to achieve is that my plugin executed first and then the
default compilation
starts. So far i've done the following:
1. I dumped the arguments for the default compilation with the '-###' argument.
2. Added my plugin invocation argument to these arguments. (-load
libpl.so -plugin pl)
After executing clang with the new argument string, i can see that
only my plugin is
executed and nothing else. So how do i achieve my goal?
Thanks,
Dimi
Hi,
-plugin replaces the codegen phase. You could use -add-plugin, which runs the plugin in addition to codegen—but after codegen (because the ast is supposed to be immutable once constructed).
What are you trying to do?
Nico
Hi,
my plugin performs some transformations on the AST. I want that the
code is generated after i performed this transformations.
Dimi
Hi,
my plugin performs some transformations on the AST. I want that the
code is generated after i performed this transformations.
As I said, I believe changing the AST after its construction is not
supported. Others might be able to say more (or why
).
Nico
It'll work if you understand the AST and its invariants well enough to
maintain them properly. That's a pretty tall order, though, and we find
that most people are excessively optimistic.
John.