diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index 58c09b23d23..ca2013ee6f0 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -249,11 +249,11 @@ public: /// 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 *Usage, const char *Title, + void printHelp(raw_ostream &OS, const char *Usage, const char *Title, unsigned FlagsToInclude, unsigned FlagsToExclude, bool ShowAllAliases) const; - void PrintHelp(raw_ostream &OS, const char *Usage, const char *Title, + void printHelp(raw_ostream &OS, const char *Usage, const char *Title, bool ShowHidden = false, bool ShowAllAliases = false) const; }; diff --git a/lib/Option/OptTable.cpp b/lib/Option/OptTable.cpp index 41bd440fe1a..f5bf166e9e6 100644 --- a/lib/Option/OptTable.cpp +++ b/lib/Option/OptTable.cpp @@ -618,13 +618,13 @@ static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) { return getOptionHelpGroup(Opts, GroupID); } -void OptTable::PrintHelp(raw_ostream &OS, const char *Usage, const char *Title, +void OptTable::printHelp(raw_ostream &OS, const char *Usage, const char *Title, bool ShowHidden, bool ShowAllAliases) const { - PrintHelp(OS, Usage, Title, /*Include*/ 0, /*Exclude*/ + printHelp(OS, Usage, Title, /*Include*/ 0, /*Exclude*/ (ShowHidden ? 0 : HelpHidden), ShowAllAliases); } -void OptTable::PrintHelp(raw_ostream &OS, const char *Usage, 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\n"; diff --git a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp index ed5f870b57e..961577f126b 100644 --- a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -122,7 +122,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef ArgsArr) { // Handle when no input or output is specified if (Args.hasArgNoClaim(OPT_INPUT) || (!Args.hasArgNoClaim(OPT_d) && !Args.hasArgNoClaim(OPT_l))) { - Table.PrintHelp(outs(), "llvm-dlltool [options] file...", "llvm-dlltool", + Table.printHelp(outs(), "llvm-dlltool [options] file...", "llvm-dlltool", false); llvm::outs() << "\nTARGETS: i386, i386:x86-64, arm, arm64\n"; return 1; diff --git a/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 80d3033244d..8f69282d344 100644 --- a/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -287,7 +287,7 @@ int llvm::libDriverMain(ArrayRef ArgsArr) { // Handle /help if (Args.hasArg(OPT_help)) { - Table.PrintHelp(outs(), "llvm-lib [options] file...", "LLVM Lib"); + Table.printHelp(outs(), "llvm-lib [options] file...", "LLVM Lib"); return 0; } diff --git a/tools/dsymutil/dsymutil.cpp b/tools/dsymutil/dsymutil.cpp index f615d36b55f..2a8e317bef6 100644 --- a/tools/dsymutil/dsymutil.cpp +++ b/tools/dsymutil/dsymutil.cpp @@ -498,7 +498,7 @@ int main(int argc, char **argv) { } if (Args.hasArg(OPT_help)) { - T.PrintHelp( + T.printHelp( outs(), (std::string(argv[0]) + " [options] ").c_str(), "manipulate archived DWARF debug symbol files.\n\n" "dsymutil links the DWARF debug information found in the object files\n" diff --git a/tools/llvm-cvtres/llvm-cvtres.cpp b/tools/llvm-cvtres/llvm-cvtres.cpp index a77d5f1126a..24b3c652824 100644 --- a/tools/llvm-cvtres/llvm-cvtres.cpp +++ b/tools/llvm-cvtres/llvm-cvtres.cpp @@ -123,7 +123,7 @@ int main(int Argc, const char **Argv) { opt::InputArgList InputArgs = T.ParseArgs(ArgsArr, MAI, MAC); if (InputArgs.hasArg(OPT_HELP)) { - T.PrintHelp(outs(), "llvm-cvtres [options] file...", "Resource Converter"); + T.printHelp(outs(), "llvm-cvtres [options] file...", "Resource Converter"); return 0; } diff --git a/tools/llvm-lipo/llvm-lipo.cpp b/tools/llvm-lipo/llvm-lipo.cpp index 7452ecafcfc..d099ea1c222 100644 --- a/tools/llvm-lipo/llvm-lipo.cpp +++ b/tools/llvm-lipo/llvm-lipo.cpp @@ -159,14 +159,14 @@ static Config parseLipoOptions(ArrayRef ArgsArr) { " option"); if (InputArgs.size() == 0) { - // PrintHelp does not accept Twine. - T.PrintHelp(errs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); + // printHelp does not accept Twine. + T.printHelp(errs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); exit(EXIT_FAILURE); } if (InputArgs.hasArg(LIPO_help)) { - // PrintHelp does not accept Twine. - T.PrintHelp(outs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); + // printHelp does not accept Twine. + T.printHelp(outs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); exit(EXIT_SUCCESS); } diff --git a/tools/llvm-ml/llvm-ml.cpp b/tools/llvm-ml/llvm-ml.cpp index 1a6686253ff..dee5f6ff4e5 100644 --- a/tools/llvm-ml/llvm-ml.cpp +++ b/tools/llvm-ml/llvm-ml.cpp @@ -220,7 +220,7 @@ int main(int Argc, char **Argv) { if (InputArgs.hasArg(OPT_help)) { std::string Usage = llvm::formatv("{0} [ /options ] file", ProgName).str(); - T.PrintHelp(outs(), Usage.c_str(), "LLVM MASM Assembler", + T.printHelp(outs(), Usage.c_str(), "LLVM MASM Assembler", /*ShowHidden=*/false); return 0; } else if (InputFilename.empty()) { diff --git a/tools/llvm-mt/llvm-mt.cpp b/tools/llvm-mt/llvm-mt.cpp index 997e5acbe23..6f26765331b 100644 --- a/tools/llvm-mt/llvm-mt.cpp +++ b/tools/llvm-mt/llvm-mt.cpp @@ -109,7 +109,7 @@ int main(int Argc, const char **Argv) { } if (InputArgs.hasArg(OPT_help)) { - T.PrintHelp(outs(), "llvm-mt [options] file...", "Manifest Tool", false); + T.printHelp(outs(), "llvm-mt [options] file...", "Manifest Tool", false); return 0; } diff --git a/tools/llvm-objcopy/ConfigManager.cpp b/tools/llvm-objcopy/ConfigManager.cpp index 39c5857e2c3..70939ee8966 100644 --- a/tools/llvm-objcopy/ConfigManager.cpp +++ b/tools/llvm-objcopy/ConfigManager.cpp @@ -459,7 +459,7 @@ static void printHelp(const opt::OptTable &OptTable, raw_ostream &OS, HelpText = " [options] input"; break; } - OptTable.PrintHelp(OS, (ToolName + HelpText).str().c_str(), + OptTable.printHelp(OS, (ToolName + HelpText).str().c_str(), (ToolName + " tool").str().c_str()); // TODO: Replace this with libOption call once it adds extrahelp support. // The CommandLine library has a cl::extrahelp class to support this, diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 2f0e05e3d26..b0ca095db38 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -99,8 +99,8 @@ public: void printHelp(StringRef Argv0, bool ShowHidden = false) const { Argv0 = sys::path::filename(Argv0); - PrintHelp(outs(), (Argv0 + Usage).str().c_str(), Description, ShowHidden, - ShowHidden); + opt::OptTable::printHelp(outs(), (Argv0 + Usage).str().c_str(), Description, + ShowHidden, ShowHidden); // TODO Replace this with OptTable API once it adds extrahelp support. outs() << "\nPass @FILE as argument to read options from FILE.\n"; } diff --git a/tools/llvm-rc/llvm-rc.cpp b/tools/llvm-rc/llvm-rc.cpp index 33d94c37ced..dc01fd0c2e9 100644 --- a/tools/llvm-rc/llvm-rc.cpp +++ b/tools/llvm-rc/llvm-rc.cpp @@ -347,7 +347,7 @@ RcOptions parseWindresOptions(ArrayRef ArgsArr, // The tool prints nothing when invoked with no command-line arguments. if (InputArgs.hasArg(WINDRES_help)) { - T.PrintHelp(outs(), "windres [options] file...", + T.printHelp(outs(), "windres [options] file...", "LLVM windres (GNU windres compatible)", false, true); exit(0); } @@ -494,7 +494,7 @@ RcOptions parseRcOptions(ArrayRef ArgsArr, // The tool prints nothing when invoked with no command-line arguments. if (InputArgs.hasArg(OPT_help)) { - T.PrintHelp(outs(), "rc [options] file...", "Resource Converter", false); + T.printHelp(outs(), "rc [options] file...", "Resource Converter", false); exit(0); } diff --git a/tools/llvm-symbolizer/llvm-symbolizer.cpp b/tools/llvm-symbolizer/llvm-symbolizer.cpp index cc816c02439..2359e5d2b45 100644 --- a/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -196,7 +196,7 @@ static void symbolizeInput(const opt::InputArgList &Args, uint64_t AdjustVMA, static void printHelp(StringRef ToolName, const SymbolizerOptTable &Tbl, raw_ostream &OS) { const char HelpText[] = " [options] addresses..."; - Tbl.PrintHelp(OS, (ToolName + HelpText).str().c_str(), + Tbl.printHelp(OS, (ToolName + HelpText).str().c_str(), ToolName.str().c_str()); // TODO Replace this with OptTable API once it adds extrahelp support. OS << "\nPass @FILE as argument to read options from FILE.\n"; diff --git a/unittests/Option/OptionParsingTest.cpp b/unittests/Option/OptionParsingTest.cpp index feeb3b7866c..f0299d2d589 100644 --- a/unittests/Option/OptionParsingTest.cpp +++ b/unittests/Option/OptionParsingTest.cpp @@ -93,11 +93,11 @@ TEST(Option, OptionParsing) { // Check the help text. std::string Help; raw_string_ostream RSO(Help); - T.PrintHelp(RSO, "test", "title!"); + T.printHelp(RSO, "test", "title!"); EXPECT_NE(std::string::npos, Help.find("-A")); // Check usage line. - T.PrintHelp(RSO, "name [options] file...", "title!"); + T.printHelp(RSO, "name [options] file...", "title!"); EXPECT_NE(std::string::npos, Help.find("USAGE: name [options] file...\n")); // Test aliases.