1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

[OptTable] Rename PrintHelp to printHelp

To be consistent with other member functions and match the coding standard.
This commit is contained in:
Fangrui Song 2021-06-24 14:47:03 -07:00
parent 1d9cb8abdf
commit 47a9b3b42d
14 changed files with 23 additions and 23 deletions

View File

@ -249,11 +249,11 @@ public:
/// that don't have help texts. By default, we display /// that don't have help texts. By default, we display
/// only options that are not hidden and have help /// only options that are not hidden and have help
/// texts. /// 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, unsigned FlagsToInclude, unsigned FlagsToExclude,
bool ShowAllAliases) const; 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; bool ShowHidden = false, bool ShowAllAliases = false) const;
}; };

View File

@ -618,13 +618,13 @@ static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) {
return getOptionHelpGroup(Opts, GroupID); 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 { bool ShowHidden, bool ShowAllAliases) const {
PrintHelp(OS, Usage, Title, /*Include*/ 0, /*Exclude*/ printHelp(OS, Usage, Title, /*Include*/ 0, /*Exclude*/
(ShowHidden ? 0 : HelpHidden), ShowAllAliases); (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, unsigned FlagsToInclude, unsigned FlagsToExclude,
bool ShowAllAliases) const { bool ShowAllAliases) const {
OS << "OVERVIEW: " << Title << "\n\n"; OS << "OVERVIEW: " << Title << "\n\n";

View File

@ -122,7 +122,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
// Handle when no input or output is specified // Handle when no input or output is specified
if (Args.hasArgNoClaim(OPT_INPUT) || if (Args.hasArgNoClaim(OPT_INPUT) ||
(!Args.hasArgNoClaim(OPT_d) && !Args.hasArgNoClaim(OPT_l))) { (!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); false);
llvm::outs() << "\nTARGETS: i386, i386:x86-64, arm, arm64\n"; llvm::outs() << "\nTARGETS: i386, i386:x86-64, arm, arm64\n";
return 1; return 1;

View File

@ -287,7 +287,7 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
// Handle /help // Handle /help
if (Args.hasArg(OPT_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; return 0;
} }

View File

@ -498,7 +498,7 @@ int main(int argc, char **argv) {
} }
if (Args.hasArg(OPT_help)) { if (Args.hasArg(OPT_help)) {
T.PrintHelp( T.printHelp(
outs(), (std::string(argv[0]) + " [options] <input files>").c_str(), outs(), (std::string(argv[0]) + " [options] <input files>").c_str(),
"manipulate archived DWARF debug symbol files.\n\n" "manipulate archived DWARF debug symbol files.\n\n"
"dsymutil links the DWARF debug information found in the object files\n" "dsymutil links the DWARF debug information found in the object files\n"

View File

@ -123,7 +123,7 @@ int main(int Argc, const char **Argv) {
opt::InputArgList InputArgs = T.ParseArgs(ArgsArr, MAI, MAC); opt::InputArgList InputArgs = T.ParseArgs(ArgsArr, MAI, MAC);
if (InputArgs.hasArg(OPT_HELP)) { 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; return 0;
} }

View File

@ -159,14 +159,14 @@ static Config parseLipoOptions(ArrayRef<const char *> ArgsArr) {
" option"); " option");
if (InputArgs.size() == 0) { if (InputArgs.size() == 0) {
// PrintHelp does not accept Twine. // printHelp does not accept Twine.
T.PrintHelp(errs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); T.printHelp(errs(), "llvm-lipo input[s] option[s]", "llvm-lipo");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (InputArgs.hasArg(LIPO_help)) { if (InputArgs.hasArg(LIPO_help)) {
// PrintHelp does not accept Twine. // printHelp does not accept Twine.
T.PrintHelp(outs(), "llvm-lipo input[s] option[s]", "llvm-lipo"); T.printHelp(outs(), "llvm-lipo input[s] option[s]", "llvm-lipo");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }

View File

@ -220,7 +220,7 @@ int main(int Argc, char **Argv) {
if (InputArgs.hasArg(OPT_help)) { if (InputArgs.hasArg(OPT_help)) {
std::string Usage = llvm::formatv("{0} [ /options ] file", ProgName).str(); 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); /*ShowHidden=*/false);
return 0; return 0;
} else if (InputFilename.empty()) { } else if (InputFilename.empty()) {

View File

@ -109,7 +109,7 @@ int main(int Argc, const char **Argv) {
} }
if (InputArgs.hasArg(OPT_help)) { 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; return 0;
} }

View File

@ -459,7 +459,7 @@ static void printHelp(const opt::OptTable &OptTable, raw_ostream &OS,
HelpText = " [options] input"; HelpText = " [options] input";
break; break;
} }
OptTable.PrintHelp(OS, (ToolName + HelpText).str().c_str(), OptTable.printHelp(OS, (ToolName + HelpText).str().c_str(),
(ToolName + " tool").str().c_str()); (ToolName + " tool").str().c_str());
// TODO: Replace this with libOption call once it adds extrahelp support. // TODO: Replace this with libOption call once it adds extrahelp support.
// The CommandLine library has a cl::extrahelp class to support this, // The CommandLine library has a cl::extrahelp class to support this,

View File

@ -99,8 +99,8 @@ public:
void printHelp(StringRef Argv0, bool ShowHidden = false) const { void printHelp(StringRef Argv0, bool ShowHidden = false) const {
Argv0 = sys::path::filename(Argv0); Argv0 = sys::path::filename(Argv0);
PrintHelp(outs(), (Argv0 + Usage).str().c_str(), Description, ShowHidden, opt::OptTable::printHelp(outs(), (Argv0 + Usage).str().c_str(), Description,
ShowHidden); ShowHidden, ShowHidden);
// TODO Replace this with OptTable API once it adds extrahelp support. // TODO Replace this with OptTable API once it adds extrahelp support.
outs() << "\nPass @FILE as argument to read options from FILE.\n"; outs() << "\nPass @FILE as argument to read options from FILE.\n";
} }

View File

@ -347,7 +347,7 @@ RcOptions parseWindresOptions(ArrayRef<const char *> ArgsArr,
// The tool prints nothing when invoked with no command-line arguments. // The tool prints nothing when invoked with no command-line arguments.
if (InputArgs.hasArg(WINDRES_help)) { if (InputArgs.hasArg(WINDRES_help)) {
T.PrintHelp(outs(), "windres [options] file...", T.printHelp(outs(), "windres [options] file...",
"LLVM windres (GNU windres compatible)", false, true); "LLVM windres (GNU windres compatible)", false, true);
exit(0); exit(0);
} }
@ -494,7 +494,7 @@ RcOptions parseRcOptions(ArrayRef<const char *> ArgsArr,
// The tool prints nothing when invoked with no command-line arguments. // The tool prints nothing when invoked with no command-line arguments.
if (InputArgs.hasArg(OPT_help)) { 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); exit(0);
} }

View File

@ -196,7 +196,7 @@ static void symbolizeInput(const opt::InputArgList &Args, uint64_t AdjustVMA,
static void printHelp(StringRef ToolName, const SymbolizerOptTable &Tbl, static void printHelp(StringRef ToolName, const SymbolizerOptTable &Tbl,
raw_ostream &OS) { raw_ostream &OS) {
const char HelpText[] = " [options] addresses..."; 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()); ToolName.str().c_str());
// TODO Replace this with OptTable API once it adds extrahelp support. // TODO Replace this with OptTable API once it adds extrahelp support.
OS << "\nPass @FILE as argument to read options from FILE.\n"; OS << "\nPass @FILE as argument to read options from FILE.\n";

View File

@ -93,11 +93,11 @@ TEST(Option, OptionParsing) {
// Check the help text. // Check the help text.
std::string Help; std::string Help;
raw_string_ostream RSO(Help); raw_string_ostream RSO(Help);
T.PrintHelp(RSO, "test", "title!"); T.printHelp(RSO, "test", "title!");
EXPECT_NE(std::string::npos, Help.find("-A")); EXPECT_NE(std::string::npos, Help.find("-A"));
// Check usage line. // 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")); EXPECT_NE(std::string::npos, Help.find("USAGE: name [options] file...\n"));
// Test aliases. // Test aliases.