[cfe-dev] AST transformations in a plugin
David Blaikie
dblaikie at gmail.com
Wed Jan 23 22:50:13 PST 2013
If you don't want to rewrite code (ie. If you have no need for source code
to come out of this process), don't. If you want to instrument code to
track various runtime properties like adding extra checks, profiling, etc -
do that with IR. See, for example, how the sanitizers (ubsan, msan, as an)
are implemented. Either as pure IR transformations, or as extra IR
generates by clang
On Jan 23, 2013 9:50 PM, "JohnH" <jan.hoogerbrugge at gmail.com> wrote:
> Hi,
>
> I am new to clang so perhaps this is a beginners question....
>
> I am trying to add some instrumentation code and I want to use a plugin for
> that. I use Rewriter to
> build new code where the new code consists of pretty printed ASTs with my
> own instrumentation
> code. Is this the way to do this? The first problem that I encountered is
> that the new code is not
> passed further down the compilation chain but gets stored in a
> RewriteBuffer. Should I somehow
> re-parse this code?
>
> Is tooling::RefactoringTool a better method to use than Rewriter? If so,
> are
> there examples available?
>
> Finally a question about plugins. Are they compatible between clang
> versions? (I am afraid that they are not).
>
> Regards,
> John
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/AST-transformations-in-a-plugin-tp4029993.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130123/5d19e734/attachment.html>
More information about the cfe-dev
mailing list