I'm using llvm::cl (from llvm 11) to handle my program's options, and want to access the names of all the registered options and their parsed values. While I can get at the options themselves with getRegisteredOptions(), I don't see a way to access to the parsed values.
There are printing functions that internally call a getOptionValue() method of the parser class, but I also can't figure out how to get at the parser class for a given option.
https://llvm.org/doxygen/CommandLine_8cpp_source.html#l02020
If I had that, I think the code would look something like:
for (auto &opt_entry : llvm::cl::getRegisteredOptions()) {
auto name = opt_entry.first();
llvm::cl::Option *opt = opt_entry.second;
auto pos = opt->getPosition();
// llvm::cl::generic_parser_base::getOptionValue(pos); <-- but with a parser object
}