[cfe-dev] Run clang plugin as additional step

Bernardo Rufino bermonruf at gmail.com
Sun Apr 12 11:31:28 PDT 2015


I found the -add-plugin option, but it doesn't really let me modify the
AST, the relevant part is in this file
<http://clang.llvm.org/doxygen/FrontendAction_8cpp_source.html> line 147.
Due to this explicit restriction I feel that modifying the AST through
plugins is not a solution. Where should I do this?

On Sat, Apr 11, 2015 at 10:43 PM, Bernardo Rufino <bermonruf at gmail.com>
wrote:

> Hi all,
>
> I want to develop a hook that will only modify the AST as an intermediate
> step, handing off the modified AST for the next pipeline stages (codegen,
> etc.). I thought that plugins were the way to go but I found that when
> using them Clang simply yields control of the pipeline to them, meaning
> further stages are not run and the execution of the plugin is the last one.
> Is this understanding correct?
> If so, how can I execute a plugin as a simple hook in the whole process
> which modifies the in-memory AST before code generation?
> Or, how can I trigger codegen inside my plugin if the above is not
> possible?
> Any other ideas are welcome, possibly I'm doing things at the wrong place.
>
> Thanks,
> --
> Bernardo Rufino
> bernardorufino.com.br <http://www.bernardorufino.com.br/>
> +55 21 9 9428-4547
> +55 12 9 8213-3648
>



-- 
Bernardo Rufino
bernardorufino.com.br <http://www.bernardorufino.com.br/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150412/975700e4/attachment.html>


More information about the cfe-dev mailing list