From 88478bbc603222965b9f617acccb0d7ba409ac3b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 10 Oct 2018 00:15:31 +0000 Subject: [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] " Summary: Before, "[options] " is unconditionally appended to the `Name` parameter. It is more flexible to change its semantic to `Usage` and let user customize the usage line. % llvm-objcopy ... USAGE: llvm-objcopy [ ] [options] With this patch: % llvm-objcopy ... USAGE: llvm-objcopy input [output] Reviewers: rupprecht, alexshap, jhenderson Reviewed By: rupprecht Subscribers: jakehehrlich, mehdi_amini, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51009 llvm-svn: 344097 --- llvm/lib/Option/OptTable.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Option/OptTable.cpp') diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index 022b9d5d933..312ff780875 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -521,19 +521,17 @@ static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) { return getOptionHelpGroup(Opts, GroupID); } -void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title, +void OptTable::PrintHelp(raw_ostream &OS, const char *Usage, const char *Title, bool ShowHidden, bool ShowAllAliases) const { - PrintHelp(OS, Name, Title, /*Include*/ 0, /*Exclude*/ + PrintHelp(OS, Usage, 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 *Usage, const char *Title, unsigned FlagsToInclude, unsigned FlagsToExclude, bool ShowAllAliases) const { - OS << "OVERVIEW: " << Title << "\n"; - OS << '\n'; - OS << "USAGE: " << Name << " [options] \n"; - OS << '\n'; + 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. -- cgit v1.2.3