[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)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 8 10:14:58 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())
----------------
snehasish 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.
https://github.com/llvm/llvm-project/pull/71328
More information about the llvm-commits
mailing list