[LLVMdev] Programmatically setting command line options?

Paul Melis llvm at assumetheposition.nl
Sun Jun 7 02:41:21 PDT 2009


Eli Friedman wrote:
> On Sun, Jun 7, 2009 at 1:48 AM, Paul Melis<llvm at assumetheposition.nl> wrote:
>   
>> Hello,
>>
>> Is there currently a way to set options, like -time-passes or -regalloc
>> from C++? I looked at the code in lib/Support/CommandLine.cpp, but the
>> stuff that comes closest to providing such functionality (mostly
>> GetOptionInfo()) is marked static.
>>     
>
> You can manipulate the command-line you pass to
> llvm::cl::ParseCommandLineOptions; other than that, there isn't any
> easy way to do it.  Patches to expose functionality using an option
> into the C++ API are generally welcome if they are clean.
>   
Thanks! Using ParseCommandLineOptions will do for now, I guess.
> In an ideal world, I guess we wouldn't have any command-line options
> in lib/, but adding options that way is really convenient :)
>   

Err,  yes, I can see from the sheer number of options defined there :)

Regards,
Paul



More information about the llvm-dev mailing list