[llvm] [llvm-support][llvm-profdata] Use cl::Subcommand to organize show options. And look up in top-level as a fallback if a special subcommand doesn't have an option. (PR #71328)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 8 21:50:04 PST 2023
================
@@ -1667,6 +1667,13 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
Handler = LookupLongOption(*ChosenSubCommand, ArgName, Value,
LongOptionsUseDoubleDash, HaveDoubleDash);
+ // If Handler is not found in a specialized subcommand, look up handler
+ // in the top-level subcommand.
+ // cl::opt without cl::sub belongs to top-level subcommand.
+ if (!Handler && ChosenSubCommand != &SubCommand::getTopLevel())
----------------
minglotus-6 wrote:
> Lets split the changes llvm/Support/CommandLine out into a separate patch and add a test to cover this case. We can reference this PR as the motivation.
Sent out pr/71776 as a separate patch.
https://github.com/llvm/llvm-project/pull/71328
More information about the llvm-commits
mailing list