[clang] [clang-tools-extra] [lld] [llvm] [llvm] Add subcommand support for OptTable (PR #155026)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 5 14:52:57 PDT 2025
================
@@ -280,6 +281,12 @@ class ArgList {
/// list.
virtual unsigned getNumInputArgStrings() const = 0;
+ /// getSubcommand - Return the active subcommand, if one exists.
+ LLVM_ABI StringRef getSubcommand(
+ const ArrayRef<OptTable::Command> Commands,
+ std::function<void(ArrayRef<StringRef>)> HandleMultipleSubcommands,
+ std::function<void(ArrayRef<StringRef>)> HandleOtherPositionals) const;
----------------
PiJoules wrote:
Maybe add comments above briefly explaining what these callbacks are for. Mostly requesting since the implication to me (based on the example usage) is that a user might want to just throw an error and exit. If this is the primary/only desirable case, then that might be worth noting. I personally can't think of a reason one might not want to print help and exit, but maybe someone else might have a reason to. We could probably discourage that with comments or maybe saying the callback is NoReturn if we want.
https://github.com/llvm/llvm-project/pull/155026
More information about the llvm-commits
mailing list