LLVM API Documentation
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 1817 of file CommandLine.h.
Definition at line 439 of file CommandLine.h.
Definition at line 127 of file CommandLine.h.
enum llvm::cl::MiscFlags |
Definition at line 134 of file CommandLine.h.
Definition at line 83 of file CommandLine.h.
Definition at line 106 of file CommandLine.h.
Definition at line 99 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 1820 of file CommandLine.cpp.
References ExtraVersionPrinters.
void llvm::cl::apply | ( | const Mod & | M, |
Opt * | O | ||
) |
Definition at line 1049 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, Storage, ParserClass >::list(), and llvm::cl::opt< DataType, ExternalStorage, ParserClass >::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.
Expand response files on a command line recursively using the given StringSaver and tokenization strategy.
[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 678 of file CommandLine.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), ExpandResponseFile(), I, llvm::SmallVectorImpl< T >::insert(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by ParseCommandLineOptions().
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< bool > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< boolOrDefault > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< int > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< unsigned > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< unsigned long long > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< double > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< float > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< std::string > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class basic_parser< char > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class opt< unsigned > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class opt< int > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class opt< std::string > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class opt< char > | ) |
llvm::cl::EXTERN_TEMPLATE_INSTANTIATION | ( | class opt< bool > | ) |
void llvm::cl::getRegisteredOptions | ( | StringMap< Option * > & | Map | ) |
Use this to get a StringMap to all registered named options (e.g. -help). Note Map
Should be an empty StringMap.
[out] | Map | will be filled with mappings where the key is the Option argument string (e.g. "help") and value is the corresponding Option*. |
Access to unnamed arguments (i.e. positional) are not provided because it is expected that the client already has access to these.
Typical usage:
main(int argc,char* argv[]) { StringMap<llvm::cl::Option*> opts; llvm::cl::getRegisteredOptions(opts); assert(opts.count("help") == 1) opts["help"]->setDescription("Show alphabetical help information") // More code llvm::cl::ParseCommandLineOptions(argc,argv); //More code }
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().
Definition at line 1827 of file CommandLine.cpp.
References GetOptionInfo(), and llvm::StringMapImpl::size().
initializer<Ty> llvm::cl::init | ( | const Ty & | Val | ) |
Definition at line 319 of file CommandLine.h.
Referenced by llvm::StringMapImpl::LookupBucketFor(), and llvm::StringMapImpl::StringMapImpl().
LocationClass<Ty> llvm::cl::location | ( | Ty & | L | ) |
Definition at line 338 of file CommandLine.h.
Referenced by setPrefixPresent().
void llvm::cl::MarkOptionsChanged | ( | ) |
Definition at line 99 of file CommandLine.cpp.
References OptionListChanged.
Referenced by llvm::cl::Option::addArgument(), llvm::cl::parser< const PassInfo * >::addLiteralOption(), and llvm::cl::Option::removeArgument().
void llvm::cl::ParseCommandLineOptions | ( | int | argc, |
const char *const * | argv, | ||
const char * | Overview = nullptr |
||
) |
Definition at line 769 of file CommandLine.cpp.
References llvm::cl::Option::ArgStr, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::StringMap< ValueTy, AllocatorTy >::clear(), llvm::SmallVectorImpl< T >::clear(), ConsumeAfter, llvm::StringRef::data(), llvm::dbgs(), DEBUG, EatsUnboundedNumberOfValues(), llvm::SmallVectorBase::empty(), llvm::StringMapImpl::empty(), llvm::StringRef::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::cl::Option::error(), llvm::errs(), ExpandResponseFiles(), llvm::sys::path::filename(), llvm::cl::Option::getFormattingFlag(), llvm::cl::Option::getMiscFlags(), GetOptionInfo(), HandlePrefixedOrGroupedOption(), I, llvm_unreachable, LookupNearestOption(), LookupOption(), llvm::LibFunc::memcpy, MoreHelp, OneOrMore, Optional, OptionListChanged, Positional, PositionalEatsArgs, ProgramName, ProgramOverview, ProvideOption(), ProvidePositionalOption(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), Required, RequiresValue(), llvm::StringRef::size(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::StringRef::substr(), TokenizeGNUCommandLine(), and ZeroOrMore.
Referenced by 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 745 of file CommandLine.cpp.
References llvm::LibFunc::getenv, ParseCommandLineOptions(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), and TokenizeGNUCommandLine().
void llvm::cl::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.
NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
Hidden | if true will print hidden options |
Categorized | if true print options in categories |
Definition at line 1793 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 964 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 993 of file CommandLine.h.
References llvm::cl::OptionDiffPrinter< ParserDT, ValDT >::print().
void llvm::cl::PrintOptionValues | ( | ) |
Definition at line 1707 of file CommandLine.cpp.
References GetOptionInfo(), PrintAllOptions, PrintOptions, llvm::SmallVectorTemplateCommon< T >::size(), and sortOpts().
void llvm::cl::PrintVersionMessage | ( | ) |
Utility function for printing version number.
Definition at line 1812 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 1816 of file CommandLine.cpp.
References OverrideVersionPrinter.
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< bool > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< boolOrDefault > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< int > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< unsigned > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< unsigned long long > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< double > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< float > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< std::string > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class basic_parser< char > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class opt< unsigned > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class opt< int > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class opt< std::string > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class opt< char > | ) |
llvm::cl::TEMPLATE_INSTANTIATION | ( | class opt< bool > | ) |
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 476 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::cl::StringSaver::SaveString(), and llvm::StringRef::size().
Referenced by ParseCommandLineOptions(), and 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 572 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::cl::StringSaver::SaveString(), and llvm::StringRef::size().
ValuesClass<DataType> END_WITH_NULL llvm::cl::values | ( | const char * | Arg, |
DataType | Val, | ||
const char * | Desc, | ||
... | |||
) |
Definition at line 517 of file CommandLine.h.