================
@@ -534,6 +555,21 @@ InputArgList OptTable::internalParseArgs(
 
   MissingArgIndex = MissingArgCount = 0;
   unsigned Index = 0, End = ArgArr.size();
+  const Command *ActiveCommand = nullptr;
+
+  // Look for subcommand which is positional.
+  if (!Commands.empty() && Index < End) {
+    StringRef FirstArg = Args.getArgString(Index);
+    if (isInput(PrefixesUnion, FirstArg)) {
+      for (const auto &C : Commands) {
+        if (FirstArg == C.Name) {
+          ActiveCommand = &C;
+          break;
+        }
+      }
----------------
PiJoules wrote:

Alternatively, it looks like you have `getActiveCommand` below so maybe you 
could reuse it here.

https://github.com/llvm/llvm-project/pull/155026
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to