Access to command line from within a pass

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 -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

Hi Scott,

Thanks for the response, but apparently I didn't explain my question
well enough. My pass already processes command-line options just fine
(using "if (Foo == 123) { ... }" sort of lines). What I additionally
want to do is embed a constant string into the bitcode containing all
of the "-option=value" terms provided to my pass. For example, if a
user runs "opt -load -foo=123 -std-compile-opts -baz", I'd
want to embed something like = private constant [14 x i8] c"-foo=123 -baz\00", align 8
     @myoptions = linkonce_odr constant i8* getelementptr inbounds ([14 x i8]*, i64 0, i64 0)

in the bitcode. Yes, I can do this with

     if (Foo != default_Foo)
       mystring += "-foo=" + Foo;

but I have a lot of options and don't want to run the risk of adding a
new option but forgetting to include it in the string accumulation;
I'd like something more automatic.

For the time being, I'm parsing /proc/self/cmdline, but if there's a
more portable or more convenient mechanism, I'd love to find out about

-- Scott