[LLVMdev] Setting options when using libraries

Chris Lattner sabre at nondot.org
Wed Mar 16 08:16:40 PST 2005

On Wed, 16 Mar 2005, Morten Ofstad wrote:

> just a quick question, how do you set options when you are linking with the 
> LLVM libraries?
> for example, the option:
>  cl::opt<bool> DisablePatternISel("disable-pattern-isel", cl::Hidden,
>                                 cl::desc("Disable the pattern isel XXX 
> FIXME"),
>                                   cl::init(true));
> How do I change it from within our application?

Probably the easiest way to do this is to just do something like this:

const char *args[] = { "-disable-pattern-isel", "false", 0 };
cl::ParseCommandLineOptions(2, args);

> Up to now I've been changing the defaults in the LLVM sources and 
> recompiling, but it seems a very very stupid way of doing it, but I could not 
> find anything in the documentation about how to set options through the API..

The other way to do it would be to add a boolean somewhere that overrides 



More information about the llvm-dev mailing list