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

Santosh Nagarakatte santosh.nagarakatte at gmail.com
Wed Dec 15 09:48:33 PST 2010


Thanks, thats helpful.

Also, I want to pass an extra argument to my pass as shown below.
clang -my_rewriter -my_rewriter_option foo.c

I think I don't need to do most of the modifications you suggested for
-my_rewriter_option and those are required only for -my_rewriter.

Any suggestions, Am I wrong?

Thanks,
Santosh

On Wed, Dec 15, 2010 at 12:31 PM, Nico Weber <thakis at chromium.org> wrote:
> 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
>>
>



-- 
Santosh G Nagarakatte,
PhD Student,
Computer and Information Science Department
University of Pennsylvania,
Philadelphia-19104
http://www.cis.upenn.edu/~santoshn




More information about the cfe-dev mailing list