LLVM CommandLine library always group single character options, for example
llvm::opt optA(“A”);
llvm::opt optB(“B”);
-AB will be treated as equivalent to -A -B, and optA and optB will both be enabled.
But sometimes we don’t want the behaviour like this. I am enhancing my program and trying to handle the options with LLVM CommandLine library instead of the original flow.
I gradually add cl::opt<> or cl::list<> to handle some options, and I have llvm::liststd::string unknownOptions(llvm:
:Sink) to collect unknown options and pass them to the original flow.
However, if the arguments starts with character “A”(e.g. -Axxxxx), it will unexpectedly enable optA. As it shoule be an unknown option, we may handle it in a later version. If the arguments starts with “AB”(e.g. -ABxxxxxx), both optA and optB will be enabled.
I don’t know if a new MiscFlags option such as llvm::NoGrouping can be provided so that the grouping can be disabled for single char options.