[cfe-dev] Passing arguments to a custom clang pass

Nico Weber thakis at chromium.org
Wed Dec 15 09:31:50 PST 2010


Hi,

all but the last 4 files in this changelist show how to plumb a
parameter from the driver though to cc1
http://codereview.appspot.com/2826041/ . It might be easier to have a
self-contained binary for your rewriter instead of putting your pass
into clang proper – this will look something like
https://github.com/nico/clangtut/blob/master/tut_rewrite.cpp , but I
haven't figured out how to deal with flags parsing best (currently,
this binary only accepts cc1 options, not all driver options, which is
a bit of a bummer.)

Nico

On Wed, Dec 15, 2010 at 9:03 AM, Santosh Nagarakatte
<santosh.nagarakatte at gmail.com> wrote:
> Hi all,
>
> I am writing a source to source translator for C using clang. I want
> to pass extra arguments to my source to source translator.
> What are the steps I need to follow to pass extra arguments to the pass?
> I have added an option in Options.td. How does my source to source
> translator check whether the option is specified.
> I thought it is not necessary to define an option in CC1Option.td and
> a FrontEndAction as this argument is just passed to my pass.
>
> It will helpful if someone can point me to an existing example in
> Clang or describe the steps needed.
>
> Thanks,
> Santosh
>
>
>
> --
> Santosh G Nagarakatte,
> PhD Student,
> Computer and Information Science Department
> University of Pennsylvania,
> Philadelphia-19104
> http://www.cis.upenn.edu/~santoshn
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list