[LLVMdev] Programmatically setting command line options?

Eli Friedman eli.friedman at gmail.com
Sun Jun 7 02:11:06 PDT 2009

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.

In an ideal world, I guess we wouldn't have any command-line options
in lib/, but adding options that way is really convenient :)


More information about the llvm-dev mailing list