[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: Re: [cfe-dev] clang plugins
From: Alp Toker <alp () nuanti ! com>
Date: 2014-01-29 20:14:19
Message-ID: 52E9611B.40200 () nuanti ! com
[Download RAW message or body]
On 29/01/2014 13:05, Francois de Ferriere wrote:
> 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.
Hi Francois,
It's unfortunate but frontend actions aren't chainable at the moment. =
Adding support for such a feature would benefit not only plugins but =
also the integrated pipeline itself.
However there's not much active work in the area these days -- it's not =
a technical limitation but purely class hierarchy problem with the =
*Action facilities that nobody's looked at fixing yet.
>
> 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 ?
The current "can do" solution is to either use Tooling, which provides =
some primitives to build custom pipelines, or alternatively to write =
your own tiny frontend or driver using simplified wrappers like =
BuildCompilation() or createInvocationFromCommandLine().
Alp.
>
>
> Best regards,
>
> - Fran=E7ois.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-- =
http://www.nuanti.com
the browser experts
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic