[PATCH] D51009: [opt] Make OptTable::PrintHelp append "[options] <inputs>" conditionally

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 11:10:14 PDT 2018


rupprecht added a comment.

I'm still against having a space in the string as the basis for interpreting it as a usage parameter. It's way too surprising.



================
Comment at: include/llvm/Option/OptTable.h:230
   ///                         texts.
-  void PrintHelp(raw_ostream &OS, const char *Name, const char *Title,
+  void PrintHelp(raw_ostream &OS, const char *NameOrUsage, const char *Title,
                  unsigned FlagsToInclude, unsigned FlagsToExclude,
----------------
What about including optional usage as a separate arg? e.g.
```
void PrintHelp(raw_ostream &OS, StringRef Name, StringRef Title,
               StringRef Usage="", ...) {
  OS << "USAGE: " << Name << (!Usage.empty() ? Usage : " [options] <inputs>") << '\n';
  ...
}
```
It's yet another method parameter, but there's zero magic involved.


Repository:
  rL LLVM

https://reviews.llvm.org/D51009





More information about the llvm-commits mailing list