[LLVMdev] Access to command line from within a pass

Scott Pakin pakin at lanl.gov
Fri May 10 15:09:54 PDT 2013

Is it possible for a pass to get access to the command line options
passed to it?  That is, if I use the CommandLine library to define

    cl::opt<int>  Foo("foo", ...);
    cl::opt<int>  Bar("bar", ...);
    cl::opt<bool> Baz("baz", ...);

and the user runs "opt -load mypass.so -foo=123 -std-compile-opts -baz",
can I somehow get a string containing "-foo=123 -baz"?

I suppose as a last resort I can process /proc/self/cmdline, but if
there's a cleaner approach, I'd prefer that.

-- Scott

More information about the llvm-dev mailing list