================
@@ -742,28 +747,76 @@ void OptTable::printHelp(raw_ostream &OS, const char 
*Usage, const char *Title,
 }
 
 void OptTable::internalPrintHelp(
-    raw_ostream &OS, const char *Usage, const char *Title, bool ShowHidden,
-    bool ShowAllAliases, std::function<bool(const Info &)> ExcludeOption,
+    raw_ostream &OS, const char *Usage, const char *Title, StringRef 
Subcommand,
+    bool ShowHidden, bool ShowAllAliases,
+    std::function<bool(const Info &)> ExcludeOption,
     Visibility VisibilityMask) const {
   OS << "OVERVIEW: " << Title << "\n\n";
-  OS << "USAGE: " << Usage << "\n\n";
 
   // Render help text into a map of group-name to a list of (option, help)
   // pairs.
   std::map<std::string, std::vector<OptionInfo>> GroupedOptionHelp;
 
+  const SubCommand *ActiveSubCommand =
+      std::find_if(SubCommands.begin(), SubCommands.end(),
+                   [&](const auto &C) { return Subcommand == C.Name; });
----------------
PiJoules wrote:

I could be misremembering, but find_if should return an iterator right?

Also is it always guaranteed here that `ActiveSubCommand` will be nonnull?

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

Reply via email to