How to set command line option programmatically?

Hello,

i want to use the Scalarizer pass. (http://llvm.org/doxygen/Scalarizer_8cpp_source.html). This pass exposes the "scalarize-load-store"(default false) option on the command line.
For my use-case i want to always enable this option. How can i enable this option programmatically?

Thank you

You should be able to use ParseCommandLineOptions for that.

-Krzysztof

Isn’t that supposed to be used in main() ? I’m interested in this use case as well but afaik there isn’t any generic API for this outside of main

Zhang

"mayuyu.io via llvm-dev" <llvm-dev@lists.llvm.org> writes:

Isn’t that supposed to be used in main() ? I’m interested in this use
case as well but afaik there isn’t any generic API for this outside of
main

It's just a method and can be called anywhere. It expects an array of
strings and a count. It doesn't care at all how that array was formed.
Depending on what you're doing, you might need to call
llvm::cl::ResetAllOptionOccurrences first.

                         -David