|
LLVM
3.7.0
|
cl Namespace - This namespace contains all of the command line option processing machinery. More...
Typedefs | |
| typedef void(* | TokenizerCallback )(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) |
| String tokenization function type. More... | |
Enumerations | |
| enum | NumOccurrencesFlag { Optional = 0x00, ZeroOrMore = 0x01, Required = 0x02, OneOrMore = 0x03, ConsumeAfter = 0x04 } |
| enum | ValueExpected { ValueOptional = 0x01, ValueRequired = 0x02, ValueDisallowed = 0x03 } |
| enum | OptionHidden { NotHidden = 0x00, Hidden = 0x01, ReallyHidden = 0x02 } |
| enum | FormattingFlags { NormalFormatting = 0x00, Positional = 0x01, Prefix = 0x02, Grouping = 0x03 } |
| enum | MiscFlags { CommaSeparated = 0x01, PositionalEatsArgs = 0x02, Sink = 0x04 } |
| enum | boolOrDefault { BOU_UNSET, BOU_TRUE, BOU_FALSE } |
Functions | |
| void | ParseCommandLineOptions (int argc, const char *const *argv, const char *Overview=nullptr) |
| void | ParseEnvironmentOptions (const char *progName, const char *envvar, const char *Overview=nullptr) |
| ParseEnvironmentOptions - An alternative entry point to the CommandLine library, which allows you to read the program's name from the caller (as PROGNAME) and its command-line arguments from an environment variable (whose name is given in ENVVAR). More... | |
| void | SetVersionPrinter (void(*func)()) |
| ===------------------------------------------------------------------—===// SetVersionPrinter - Override the default (LLVM specific) version printer used to print out the version when –version is given on the command line. More... | |
| void | AddExtraVersionPrinter (void(*func)()) |
| ===------------------------------------------------------------------—===// AddExtraVersionPrinter - Add an extra printer to use in addition to the default one. More... | |
| void | PrintOptionValues () |
| void | AddLiteralOption (Option &O, const char *Name) |
| Adds a new option for parsing and provides the option it refers to. More... | |
| template<class Ty > | |
| initializer< Ty > | init (const Ty &Val) |
| template<class Ty > | |
| LocationClass< Ty > | location (Ty &L) |
| template<class DataType > | |
| ValuesClass< DataType > LLVM_END_WITH_NULL | values (const char *Arg, DataType Val, const char *Desc,...) |
| template<class ParserClass , class DT > | |
| void | printOptionDiff (const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth) |
| template<class ParserClass , class ValDT > | |
| void | printOptionDiff (const Option &O, const basic_parser< typename ParserClass::parser_data_type > &P, const ValDT &V, const OptionValue< ValDT > &Default, size_t GlobalWidth) |
| template<class Opt , class Mod , class... Mods> | |
| void | apply (Opt *O, const Mod &M, const Mods &...Ms) |
| template<class Opt , class Mod > | |
| void | apply (Opt *O, const Mod &M) |
| void | PrintVersionMessage () |
| Utility function for printing version number. More... | |
| void | PrintHelpMessage (bool Hidden=false, bool Categorized=false) |
| This function just prints the help message, exactly the same way as if the -help or -help-hidden option had been given on the command line. More... | |
| StringMap< Option * > & | getRegisteredOptions () |
| Use this to get a StringMap to all registered named options (e.g. More... | |
| void | TokenizeGNUCommandLine (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
| Tokenizes a command line that can contain escapes and quotes. More... | |
| void | TokenizeWindowsCommandLine (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
| Tokenizes a Windows command line which may contain quotes and escaped quotes. More... | |
| bool | ExpandResponseFiles (StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv, bool MarkEOLs=false) |
| Expand response files on a command line recursively using the given StringSaver and tokenization strategy. More... | |
| void | HideUnrelatedOptions (cl::OptionCategory &Category) |
| Mark all options not part of this category as cl::ReallyHidden. More... | |
| void | HideUnrelatedOptions (ArrayRef< const cl::OptionCategory * > Categories) |
| Mark all options not part of the categories as cl::ReallyHidden. More... | |
Variables | |
| OptionCategory | GeneralCategory |
cl Namespace - This namespace contains all of the command line option processing machinery.
It is intentionally a short name to make qualified usage concise.
| typedef void(* llvm::cl::TokenizerCallback)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) |
String tokenization function type.
Should be compatible with either Windows or Unix command line tokenizers.
Definition at line 1715 of file CommandLine.h.
| Enumerator | |
|---|---|
| BOU_UNSET | |
| BOU_TRUE | |
| BOU_FALSE | |
Definition at line 459 of file CommandLine.h.
| Enumerator | |
|---|---|
| NormalFormatting | |
| Positional | |
| Prefix | |
| Grouping | |
Definition at line 139 of file CommandLine.h.
| enum llvm::cl::MiscFlags |
| Enumerator | |
|---|---|
| CommaSeparated | |
| PositionalEatsArgs | |
| Sink | |
Definition at line 146 of file CommandLine.h.
| Enumerator | |
|---|---|
| Optional | |
| ZeroOrMore | |
| Required | |
| OneOrMore | |
| ConsumeAfter | |
Definition at line 95 of file CommandLine.h.
| Enumerator | |
|---|---|
| NotHidden | |
| Hidden | |
| ReallyHidden | |
Definition at line 118 of file CommandLine.h.
| Enumerator | |
|---|---|
| ValueOptional | |
| ValueRequired | |
| ValueDisallowed | |
Definition at line 111 of file CommandLine.h.
| void llvm::cl::AddExtraVersionPrinter | ( | void(*)() | func | ) |
===------------------------------------------------------------------—===// AddExtraVersionPrinter - Add an extra printer to use in addition to the default one.
This can be called multiple times, and each time it adds a new function to the list which will be called after the basic LLVM version printing is complete. Each can then add additional information specific to the tool.
Definition at line 1825 of file CommandLine.cpp.
References ExtraVersionPrinters.
Adds a new option for parsing and provides the option it refers to.
| O | pointer to the option |
| Name | the string name for the option to handle during parsing |
Literal options are used by some parsers to register special option values. This is how the PassNameParser registers pass names for opt.
Definition at line 215 of file CommandLine.cpp.
References GlobalParser.
Referenced by llvm::cl::parser< const PassInfo * >::addLiteralOption().
| void llvm::cl::apply | ( | Opt * | O, |
| const Mod & | M, | ||
| const Mods &... | Ms | ||
| ) |
Definition at line 1076 of file CommandLine.h.
References llvm::cl::applicator< Mod >::opt().
Referenced by llvm::cl::alias::alias(), llvm::cl::bits< DataType, Storage, ParserClass >::bits(), llvm::cl::list< DataType, StorageClass, ParserClass >::list(), and llvm::cl::opt< DataType, ExternalStorage, ParserClass >::opt().
| void llvm::cl::apply | ( | Opt * | O, |
| const Mod & | M | ||
| ) |
Definition at line 1081 of file CommandLine.h.
References llvm::cl::applicator< Mod >::opt().
| bool llvm::cl::ExpandResponseFiles | ( | StringSaver & | Saver, |
| TokenizerCallback | Tokenizer, | ||
| SmallVectorImpl< const char * > & | Argv, | ||
| bool | MarkEOLs = false |
||
| ) |
Expand response files on a command line recursively using the given StringSaver and tokenization strategy.
Argv should contain the command line before expansion and will be modified in place. If requested, Argv will also be populated with nullptrs indicating where each response file line ends, which is useful for the "/link" argument that needs to consume all remaining arguments only until the next end of line, when in a response file.
| [in] | Saver | Delegates back to the caller for saving parsed strings. |
| [in] | Tokenizer | Tokenization strategy. Typically Unix or Windows. |
| [in,out] | Argv | Command line into which to expand response files. |
| [in] | MarkEOLs | Mark end of lines and the end of the response file with nullptrs in the Argv vector. |
Definition at line 739 of file CommandLine.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), ExpandResponseFile(), I, llvm::SmallVectorImpl< T >::insert(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::libDriverMain().
Use this to get a StringMap to all registered named options (e.g.
-help). Note Map Should be an empty StringMap.
Access to unnamed arguments (i.e. positional) are not provided because it is expected that the client already has access to these.
Typical usage:
This interface is useful for modifying options in libraries that are out of the control of the client. The options should be modified before calling llvm::cl::ParseCommandLineOptions().
Hopefully this API can be depricated soon. Any situation where options need to be modified by tools or libraries should be handled by sane APIs rather than just handing around a global list.
Definition at line 1832 of file CommandLine.cpp.
References GlobalParser.
| void llvm::cl::HideUnrelatedOptions | ( | cl::OptionCategory & | Category | ) |
Mark all options not part of this category as cl::ReallyHidden.
| Category | the category of options to keep displaying |
Some tools (like clang-format) like to be able to hide all options that are not specific to the tool. This function allows a tool to specify a single option category to display in the -help output.
Definition at line 1836 of file CommandLine.cpp.
References GenericCategory, GlobalParser, and ReallyHidden.
| void llvm::cl::HideUnrelatedOptions | ( | ArrayRef< const cl::OptionCategory * > | Categories | ) |
Mark all options not part of the categories as cl::ReallyHidden.
| Categories | the categories of options to keep displaying. |
Some tools (like clang-format) like to be able to hide all options that are not specific to the tool. This function allows a tool to specify a single option category to display in the -help output.
Definition at line 1844 of file CommandLine.cpp.
References llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), GenericCategory, GlobalParser, and ReallyHidden.
| initializer<Ty> llvm::cl::init | ( | const Ty & | Val | ) |
Definition at line 325 of file CommandLine.h.
Referenced by llvm::StringMapImpl::LookupBucketFor(), llvm::OptionRegistry::registerOption(), and llvm::StringMapImpl::StringMapImpl().
| LocationClass<Ty> llvm::cl::location | ( | Ty & | L | ) |
Definition at line 340 of file CommandLine.h.
Referenced by isPrefixAtLocation(), and setPrefixPresent().
| void CommandLineParser::ParseCommandLineOptions | ( | int | argc, |
| const char *const * | argv, | ||
| const char * | Overview = nullptr |
||
| ) |
Definition at line 812 of file CommandLine.cpp.
References GlobalParser.
Referenced by LLVMParseCommandLineOptions(), llvm::LTOCodeGenerator::parseCodeGenDebugOptions(), and ParseEnvironmentOptions().
| void llvm::cl::ParseEnvironmentOptions | ( | const char * | progName, |
| const char * | envvar, | ||
| const char * | Overview = nullptr |
||
| ) |
ParseEnvironmentOptions - An alternative entry point to the CommandLine library, which allows you to read the program's name from the caller (as PROGNAME) and its command-line arguments from an environment variable (whose name is given in ENVVAR).
Definition at line 787 of file CommandLine.cpp.
References llvm::ARM_PROC::A, ParseCommandLineOptions(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::StringSaver::save(), llvm::SmallVectorTemplateCommon< T >::size(), and TokenizeGNUCommandLine().
This function just prints the help message, exactly the same way as if the -help or -help-hidden option had been given on the command line.
NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
| Hidden | if true will print hidden options |
| Categorized | if true print options in categories |
Definition at line 1802 of file CommandLine.cpp.
References CategorizedHiddenPrinter(), CategorizedNormalPrinter(), UncategorizedHiddenPrinter(), and UncategorizedNormalPrinter().
| void llvm::cl::printOptionDiff | ( | const Option & | O, |
| const generic_parser_base & | P, | ||
| const DT & | V, | ||
| const OptionValue< DT > & | Default, | ||
| size_t | GlobalWidth | ||
| ) |
Definition at line 992 of file CommandLine.h.
References llvm::cl::generic_parser_base::printOptionDiff().
| void llvm::cl::printOptionDiff | ( | const Option & | O, |
| const basic_parser< typename ParserClass::parser_data_type > & | P, | ||
| const ValDT & | V, | ||
| const OptionValue< ValDT > & | Default, | ||
| size_t | GlobalWidth | ||
| ) |
Definition at line 1019 of file CommandLine.h.
References llvm::cl::OptionDiffPrinter< ParserDT, ValDT >::print().
| void llvm::cl::PrintOptionValues | ( | ) |
Definition at line 1717 of file CommandLine.cpp.
References GlobalParser.
| void llvm::cl::PrintVersionMessage | ( | ) |
Utility function for printing version number.
Definition at line 1821 of file CommandLine.cpp.
References VersionPrinterInstance.
| void llvm::cl::SetVersionPrinter | ( | void(*)() | func | ) |
===------------------------------------------------------------------—===// SetVersionPrinter - Override the default (LLVM specific) version printer used to print out the version when –version is given on the command line.
This allows other systems using the CommandLine utilities to print their own version string.
Definition at line 1823 of file CommandLine.cpp.
References OverrideVersionPrinter.
| void llvm::cl::TokenizeGNUCommandLine | ( | StringRef | Source, |
| StringSaver & | Saver, | ||
| SmallVectorImpl< const char * > & | NewArgv, | ||
| bool | MarkEOLs = false |
||
| ) |
Tokenizes a command line that can contain escapes and quotes.
The quoting rules match those used by GCC and other tools that use libiberty's buildargv() or expandargv() utilities, and do not match bash. They differ from buildargv() on treatment of backslashes that do not escape a special character to make it possible to accept most Windows file paths.
| [in] | Source | The string to be split on whitespace with quotes. |
| [in] | Saver | Delegates back to the caller for saving parsed strings. |
| [in] | MarkEOLs | true if tokenizing a response file and you want end of lines and end of the response file to be marked with a nullptr string. |
| [out] | NewArgv | All parsed strings are appended to NewArgv. |
Definition at line 524 of file CommandLine.cpp.
References llvm::SmallString< InternalLen >::c_str(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorBase::empty(), I, isGNUSpecial(), isQuote(), isWhitespace(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::StringSaver::save(), and llvm::StringRef::size().
Referenced by ParseEnvironmentOptions().
| void llvm::cl::TokenizeWindowsCommandLine | ( | StringRef | Source, |
| StringSaver & | Saver, | ||
| SmallVectorImpl< const char * > & | NewArgv, | ||
| bool | MarkEOLs = false |
||
| ) |
Tokenizes a Windows command line which may contain quotes and escaped quotes.
See MSDN docs for CommandLineToArgvW for information on the quoting rules. http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx
| [in] | Source | The string to be split on whitespace with quotes. |
| [in] | Saver | Delegates back to the caller for saving parsed strings. |
| [in] | MarkEOLs | true if tokenizing a response file and you want end of lines and end of the response file to be marked with a nullptr string. |
| [out] | NewArgv | All parsed strings are appended to NewArgv. |
Definition at line 622 of file CommandLine.cpp.
References llvm::SmallString< InternalLen >::c_str(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorBase::empty(), I, INIT, isWhitespace(), parseBackslash(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::StringSaver::save(), and llvm::StringRef::size().
Referenced by llvm::libDriverMain().
| ValuesClass<DataType> LLVM_END_WITH_NULL llvm::cl::values | ( | const char * | Arg, |
| DataType | Val, | ||
| const char * | Desc, | ||
| ... | |||
| ) |
Definition at line 536 of file CommandLine.h.
| OptionCategory llvm::cl::GeneralCategory |
1.8.6