[llvm] [Option] Allow subcommand names as positional arguments (PR #227077)

Prabhu Rajasekaran via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 15:02:22 PDT 2026


================

----------------
Prabhuk wrote:

This perhaps can be simplified 


```c++
        StringRef CmdName = A->getValue();
        bool IsCandidate =
            !AllowSubCommandNamesAsPositionals || SubCommands.empty();
        if (IsCandidate &&
            llvm::any_of(AllSubCommands, [&](const OptTable::SubCommand &CMD) {
              return CmdName == CMD.Name;
            }))
          SubCommands.push_back(CmdName);
        else
          OtherPositionals.push_back(CmdName);
```

https://github.com/llvm/llvm-project/pull/227077


More information about the llvm-commits mailing list