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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 11:31:14 PDT 2018


MaskRay added inline comments.


================
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,
----------------
rupprecht wrote:
> 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.
This can be temporary. If https://reviews.llvm.org/D51109 looks good, I can add "[options] <inputs>" explicitly for all call sites.


Repository:
  rL LLVM

https://reviews.llvm.org/D51009





More information about the llvm-commits mailing list