Index: include/llvm/Option/OptTable.h =================================================================== --- include/llvm/Option/OptTable.h +++ include/llvm/Option/OptTable.h @@ -217,7 +217,8 @@ /// Render the help text for an option table. /// /// \param OS - The stream to write the help text to. - /// \param Name - The name to use in the usage line. + /// \param NameOrUsage - The usage line. If without space, "[options] " + /// will be appended. /// \param Title - The title to use in the usage line. /// \param FlagsToInclude - If non-zero, only include options with any /// of these flags set. @@ -226,11 +227,11 @@ /// that don't have help texts. By default, we display /// only options that are not hidden and have help /// 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, bool ShowAllAliases) const; - void PrintHelp(raw_ostream &OS, const char *Name, const char *Title, + void PrintHelp(raw_ostream &OS, const char *NameOrUsage, const char *Title, bool ShowHidden = false, bool ShowAllAliases = false) const; }; Index: lib/Option/OptTable.cpp =================================================================== --- lib/Option/OptTable.cpp +++ lib/Option/OptTable.cpp @@ -521,19 +521,21 @@ return getOptionHelpGroup(Opts, GroupID); } -void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title, +void OptTable::PrintHelp(raw_ostream &OS, const char *NameOrUsage, const char *Title, bool ShowHidden, bool ShowAllAliases) const { - PrintHelp(OS, Name, Title, /*Include*/ 0, /*Exclude*/ + PrintHelp(OS, NameOrUsage, Title, /*Include*/ 0, /*Exclude*/ (ShowHidden ? 0 : HelpHidden), ShowAllAliases); } -void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title, +void OptTable::PrintHelp(raw_ostream &OS, const char *NameOrUsage, const char *Title, unsigned FlagsToInclude, unsigned FlagsToExclude, bool ShowAllAliases) const { OS << "OVERVIEW: " << Title << "\n"; OS << '\n'; - OS << "USAGE: " << Name << " [options] \n"; - OS << '\n'; + OS << "USAGE: " << NameOrUsage; + if (!strchr(NameOrUsage, ' ')) + OS << " [options] "; + OS << "\n\n"; // Render help text into a map of group-name to a list of (option, help) // pairs.