From 7e7ae5ad692760aa8d97477f061a05b10948cf57 Mon Sep 17 00:00:00 2001
From: Duncan Sands
The second and third parameters (which are optional) are used to specify what -to output for the "--help" option. In this case, we get a line that +to output for the "-help" option. In this case, we get a line that looks like this:
USAGE: compiler [options] OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename
USAGE: compiler [options] <input file> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename
The CommandLine library uses a different parser for different data types. For example, in the string case, the argument passed @@ -372,7 +372,7 @@ href="#doubleparser">double, and int parsers work like you would expect, using the 'strtol' and 'strtod' C library calls to parse the string value into the specified data type.
-With the declarations above, "compiler --help" emits this:
+With the declarations above, "compiler -help" emits this:
USAGE: compiler [options] <input file> @@ -381,10 +381,10 @@ OPTIONS: -f - Enable binary output on terminals -o - Override output filename -quiet - Don't print informational messages - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more)
and "compiler --help-hidden" prints this:
+and "compiler -help-hidden" prints this:
USAGE: compiler [options] <input file> @@ -394,7 +394,7 @@ OPTIONS: -o - Override output filename -q - Don't print informational messages -quiet - Don't print informational messages - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more)
This brief example has shown you how to use the 'cl::aliasopt modifier) whenever it is specified. Because aliases do not hold state, the only thing the program has to query is the Quiet variable now. Another nice feature of aliases is that they automatically hide themselves from the -help output -(although, again, they are still visible in the --help-hidden +(although, again, they are still visible in the -help-hidden output).
Now the application code can simply use:
@@ -531,7 +531,7 @@ OPTIONS: -O2 - Enable default optimizations -O3 - Enable expensive optimizations -f - Enable binary output on terminals - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages @@ -599,7 +599,7 @@ enum DebugLev {This definition defines an enumerated command line variable of type "enum DebugLev", which works exactly the same way as before. The difference here is just the interface exposed to the user of your program and the help output by -the "--help" option:
+the "-help" option:USAGE: compiler [options] <input file> @@ -615,7 +615,7 @@ OPTIONS: =quick - enable quick debug information =detailed - enable detailed debug information -f - Enable binary output on terminals - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages
Given these two option declarations, the --help output for our grep +
Given these two option declarations, the -help output for our grep replacement would look like this:
USAGE: spiffygrep [options] <regular expression> <input file> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more)
... and the resultant program could be used just like the standard @@ -872,7 +872,7 @@ Note that the system grep has the same problem:
$ spiffygrep '-foo' test.txt - Unknown command line argument '-foo'. Try: spiffygrep --help' + Unknown command line argument '-foo'. Try: spiffygrep -help' $ grep '-foo' test.txt grep: illegal option -- f @@ -986,7 +986,7 @@ shell itself. Using the CommandLine library, we would specify this as: USAGE: spiffysh [options] <input script> <program arguments>... OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -x - Enable trace output
Option modifiers are the flags and expressions that you pass into the constructors for cl::opt and cl::list. These modifiers give you the ability to -tweak how options are parsed and how --help output is generated to fit +tweak how options are parsed and how -help output is generated to fit your application well.
These options fall into five main categories:
The cl::NotHidden, cl::Hidden, and cl::ReallyHidden modifiers are used to control whether or not an option -appears in the --help and --help-hidden output for the +appears in the -help and -help-hidden output for the compiled program:
The cl::ParseCommandLineOptions function requires two parameters (argc and argv), but may also take an optional third parameter which holds additional extra text to emit when the ---help option is invoked, and a fourth boolean parameter that enables +-help option is invoked, and a fourth boolean parameter that enables response files.
The cl::extrahelp class is a nontemplated class that allows extra -help text to be printed out for the --help option.
+help text to be printed out for the -help option.namespace cl { @@ -1906,7 +1906,7 @@ MFS("max-file-size", cl::desc("Maximum file sidiff --git a/docs/CompilerDriver.html b/docs/CompilerDriver.html index 5f5788c1edf..3c82e2b0769 100644 --- a/docs/CompilerDriver.html +++ b/docs/CompilerDriver.html @@ -132,7 +132,7 @@ directory with the compilation graph description in Graphviz format (identical to the file used by the --view-graph option). The -o option can be used to set the output file name. Hidden option, useful for debugging LLVMC plugins. -OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) ... -max-file-size=<size> - Maximum file size to accept- --help, --help-hidden, --version - These options have +
- -help, -help-hidden, --version - These options have their standard meaning.
-
- help - help string associated with this option. Used for --help +
- help - help string associated with this option. Used for -help output.
- required - this option must be specified exactly once (or, in case of the list options without the multi_val property, at least @@ -338,7 +338,7 @@ it is synonymous with requiredmulti_val. Incompatible with required and one_or_more.
- hidden - the description of this option will not appear in -the --help output (but will appear in the --help-hidden +the -help output (but will appear in the -help-hidden output).
- really_hidden - the option will not be mentioned in any help output.
@@ -748,7 +748,7 @@ the Base plugin behav Mikhail Glushenkov
LLVM Compiler Infrastructure
-Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $ +Last modified: $Date$
The tools directory contains the executables built out of the libraries above, which form the main part of the user interface. You can -always get help for a tool by typing tool_name --help. The +always get help for a tool by typing tool_name -help. The following is a brief introduction to the most important tools. More detailed information is in the Command Guide.
@@ -1440,7 +1440,7 @@ information is in the Command Guide.To see what happened to the other string you registered, try running -opt with the --help option:
+opt with the -help option:-$ opt -load ../../../Debug/lib/Hello.so --help +$ opt -load ../../../Debug/lib/Hello.so -help OVERVIEW: llvm .bc -> .bc modular optimizer USAGE: opt [options] <input bitcode> @@ -970,7 +970,7 @@ template, which requires you to pass at least two parameters. The first parameter is the name of the pass that is to be used on the command line to specify that the pass should be added to a program (for example, with opt or bugpoint). The second argument is the -name of the pass, which is to be used for the --help output of +name of the pass, which is to be used for the -help output of programs, as well as for debug output generated by the --debug-pass option. @@ -1410,7 +1410,7 @@ allowing any analysis results to live across the execution of your pass. options that is useful for debugging pass execution, seeing how things work, and diagnosing when you should be preserving more analyses than you currently are (To get information about all of the variants of the --debug-pass -option, just type 'opt --help-hidden'). +option, just type 'opt -help-hidden').By using the --debug-pass=Structure option, for example, we can see how our Hello World pass interacts with other passes. @@ -1625,10 +1625,10 @@ form;
Note the two spaces prior to the help string produces a tidy result on the ---help query.
+-help query.-$ llc --help +$ llc -help ... -regalloc - Register allocator to use: (default = linearscan) =linearscan - linear scan register allocator diff --git a/include/llvm/CompilerDriver/Main.inc b/include/llvm/CompilerDriver/Main.inc index fc8b5035e0c..71bb8cb3bf7 100644 --- a/include/llvm/CompilerDriver/Main.inc +++ b/include/llvm/CompilerDriver/Main.inc @@ -10,7 +10,7 @@ // This tool provides a single point of access to the LLVM // compilation tools. It has many options. To discover the options // supported please refer to the tools' manual page or run the tool -// with the --help option. +// with the -help option. // // This file provides the default entry point for the driver executable. // diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 3ee2313b9a3..61c3256d384 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -93,9 +93,9 @@ enum ValueExpected { // Is a value required for the option? }; enum OptionHidden { // Control whether -help shows this option - NotHidden = 0x20, // Option included in --help & --help-hidden - Hidden = 0x40, // -help doesn't, but --help-hidden does - ReallyHidden = 0x60, // Neither --help nor --help-hidden show this arg + NotHidden = 0x20, // Option included in -help & -help-hidden + Hidden = 0x40, // -help doesn't, but -help-hidden does + ReallyHidden = 0x60, // Neither -help nor -help-hidden show this arg HiddenMask = 0x60 }; @@ -159,7 +159,7 @@ class Option { Option *NextRegistered; // Singly linked list of registered options. public: const char *ArgStr; // The argument string itself (ex: "help", "o") - const char *HelpStr; // The descriptive text message for --help + const char *HelpStr; // The descriptive text message for -help const char *ValueStr; // String describing what the value of this option is inline enum NumOccurrencesFlag getNumOccurrencesFlag() const { @@ -251,14 +251,14 @@ public: // command line option parsers... // -// desc - Modifier to set the description shown in the --help output... +// desc - Modifier to set the description shown in the -help output... struct desc { const char *Desc; desc(const char *Str) : Desc(Str) {} void apply(Option &O) const { O.setDescription(Desc); } }; -// value_desc - Modifier to set the value description shown in the --help +// value_desc - Modifier to set the value description shown in the -help // output... struct value_desc { const char *Desc; @@ -437,7 +437,7 @@ protected: // Default parser implementation - This implementation depends on having a // mapping of recognized options to values of some sort. In addition to this, // each entry in the mapping also tracks a help message that is printed with the -// command line option for --help. Because this is a simple mapping parser, the +// command line option for -help. Because this is a simple mapping parser, the // data type can be any unsupported type. // template@@ -1373,7 +1373,7 @@ struct extrahelp { void PrintVersionMessage(); // This function just prints the help message, exactly the same way as if the -// --help option had been given on the command line. +// -help option had been given on the command line. // NOTE: THIS FUNCTION TERMINATES THE PROGRAM! void PrintHelpMessage(); diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 961dc1fef92..2ab4103de2e 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -650,7 +650,7 @@ void cl::ParseCommandLineOptions(int argc, char **argv, if (Handler == 0) { if (SinkOpts.empty()) { errs() << ProgramName << ": Unknown command line argument '" - << argv[i] << "'. Try: '" << argv[0] << " --help'\n"; + << argv[i] << "'. Try: '" << argv[0] << " -help'\n"; ErrorParsing = true; } else { for (SmallVectorImpl