LLVM 22.0.0git
|
This namespace contains all of the command line option processing machinery. More...
Namespaces | |
namespace | detail |
Typedefs | |
using | VersionPrinterTy = std::function<void(raw_ostream &)> |
using | TokenizerCallback |
String tokenization function type. |
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 , AlwaysPrefix = 0x03 } |
enum | MiscFlags { CommaSeparated = 0x01 , PositionalEatsArgs = 0x02 , Sink = 0x04 , Grouping = 0x08 , DefaultOption = 0x10 } |
enum | boolOrDefault { BOU_UNSET , BOU_TRUE , BOU_FALSE } |
Functions | |
LLVM_ABI bool | ParseCommandLineOptions (int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, vfs::FileSystem *VFS=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false) |
LLVM_ABI void | SetVersionPrinter (VersionPrinterTy func) |
===------------------------------------------------------------------—===// Override the default (LLVM specific) version printer used to print out the version when –version is given on the command line. | |
LLVM_ABI void | AddExtraVersionPrinter (VersionPrinterTy func) |
===------------------------------------------------------------------—===// Add an extra printer to use in addition to the default one. | |
LLVM_ABI void | PrintOptionValues () |
LLVM_ABI void | AddLiteralOption (Option &O, StringRef Name) |
Adds a new option for parsing and provides the option it refers to. | |
LLVM_ABI OptionCategory & | getGeneralCategory () |
template<class Ty> | |
initializer< Ty > | init (const Ty &Val) |
template<class Ty> | |
list_initializer< Ty > | list_init (ArrayRef< Ty > Vals) |
template<class Ty> | |
LocationClass< Ty > | location (Ty &L) |
template<typename F> | |
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > | callback (F CB) |
template<typename... OptsTy> | |
ValuesClass | values (OptsTy... Options) |
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to the ValuesClass constructor. | |
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) |
LLVM_ABI void | PrintVersionMessage () |
Utility function for printing version number. | |
LLVM_ABI 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. | |
LLVM_ABI ArrayRef< StringRef > | getCompilerBuildConfig () |
An array of optional enabled settings in the LLVM build configuration, which may be of interest to compiler developers. | |
LLVM_ABI void | printBuildConfig (raw_ostream &OS) |
Prints the compiler build configuration. | |
LLVM_ABI StringMap< Option * > & | getRegisteredOptions (SubCommand &Sub=SubCommand::getTopLevel()) |
Use this to get a StringMap to all registered named options (e.g. | |
LLVM_ABI iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > | getRegisteredSubcommands () |
Use this to get all registered SubCommands from the provided parser. | |
LLVM_ABI void | TokenizeGNUCommandLine (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
Tokenizes a command line that can contain escapes and quotes. | |
LLVM_ABI void | TokenizeWindowsCommandLine (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
Tokenizes a string of Windows command line arguments, which may contain quotes and escaped quotes. | |
LLVM_ABI void | TokenizeWindowsCommandLineNoCopy (StringRef Source, StringSaver &Saver, SmallVectorImpl< StringRef > &NewArgv) |
Tokenizes a Windows command line while attempting to avoid copies. | |
LLVM_ABI void | TokenizeWindowsCommandLineFull (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
Tokenizes a Windows full command line, including command name at the start. | |
LLVM_ABI void | tokenizeConfigFile (StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false) |
Tokenizes content of configuration file. | |
LLVM_ABI bool | expandResponseFiles (int Argc, const char *const *Argv, const char *EnvVar, SmallVectorImpl< const char * > &NewArgv) |
A convenience helper which concatenates the options specified by the environment variable EnvVar and command line options, then expands response files recursively. | |
LLVM_ABI bool | ExpandResponseFiles (StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv) |
A convenience helper which supports the typical use case of expansion function call. | |
LLVM_ABI bool | expandResponseFiles (int Argc, const char *const *Argv, const char *EnvVar, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv) |
A convenience helper which concatenates the options specified by the environment variable EnvVar and command line options, then expands response files recursively. | |
LLVM_ABI void | HideUnrelatedOptions (cl::OptionCategory &Category, SubCommand &Sub=SubCommand::getTopLevel()) |
Mark all options not part of this category as cl::ReallyHidden. | |
LLVM_ABI void | HideUnrelatedOptions (ArrayRef< const cl::OptionCategory * > Categories, SubCommand &Sub=SubCommand::getTopLevel()) |
Mark all options not part of the categories as cl::ReallyHidden. | |
LLVM_ABI void | ResetAllOptionOccurrences () |
Reset all command line options to a state that looks as if they have never appeared on the command line. | |
LLVM_ABI void | ResetCommandLineParser () |
Reset the command line parser back to its initial state. | |
LLVM_ABI bool | ProvidePositionalOption (Option *Handler, StringRef Arg, int i) |
Parses Arg into the option handler Handler. |
Variables | |
template class LLVM_TEMPLATE_ABI | basic_parser< bool > |
template class LLVM_TEMPLATE_ABI | basic_parser< boolOrDefault > |
template class LLVM_TEMPLATE_ABI | basic_parser< int > |
template class LLVM_TEMPLATE_ABI | basic_parser< long > |
template class LLVM_TEMPLATE_ABI | basic_parser< long long > |
template class LLVM_TEMPLATE_ABI | basic_parser< unsigned > |
template class LLVM_TEMPLATE_ABI | basic_parser< unsigned long > |
template class LLVM_TEMPLATE_ABI | basic_parser< unsigned long long > |
template class LLVM_TEMPLATE_ABI | basic_parser< double > |
template class LLVM_TEMPLATE_ABI | basic_parser< float > |
template class LLVM_TEMPLATE_ABI | basic_parser< std::string > |
template class LLVM_TEMPLATE_ABI | basic_parser< char > |
template class LLVM_TEMPLATE_ABI | opt< std::string > |
template class LLVM_TEMPLATE_ABI | opt< unsigned > |
template class LLVM_TEMPLATE_ABI | opt< int > |
template class LLVM_TEMPLATE_ABI | opt< char > |
template class LLVM_TEMPLATE_ABI | opt< bool > |
This namespace contains all of the command line option processing machinery.
It is intentionally a short name to make qualified usage concise.
String tokenization function type.
Should be compatible with either Windows or Unix command line tokenizers.
Definition at line 2146 of file CommandLine.h.
using llvm::cl::VersionPrinterTy = std::function<void(raw_ostream &)> |
Definition at line 77 of file CommandLine.h.
Enumerator | |
---|---|
BOU_UNSET | |
BOU_TRUE | |
BOU_FALSE |
Definition at line 639 of file CommandLine.h.
Enumerator | |
---|---|
NormalFormatting | |
Positional | |
Prefix | |
AlwaysPrefix |
Definition at line 157 of file CommandLine.h.
enum llvm::cl::MiscFlags |
Enumerator | |
---|---|
CommaSeparated | |
PositionalEatsArgs | |
Sink | |
Grouping | |
DefaultOption |
Definition at line 164 of file CommandLine.h.
Enumerator | |
---|---|
Optional | |
ZeroOrMore | |
Required | |
OneOrMore | |
ConsumeAfter |
Definition at line 114 of file CommandLine.h.
Enumerator | |
---|---|
NotHidden | |
Hidden | |
ReallyHidden |
Definition at line 137 of file CommandLine.h.
Enumerator | |
---|---|
ValueOptional | |
ValueRequired | |
ValueDisallowed |
Definition at line 130 of file CommandLine.h.
void llvm::cl::AddExtraVersionPrinter | ( | VersionPrinterTy | func | ) |
===------------------------------------------------------------------—===// 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 2804 of file CommandLine.cpp.
References CommonOptions, and func.
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 442 of file CommandLine.cpp.
References GlobalParser.
Referenced by llvm::cl::parser< DataType >::addLiteralOption().
Definition at line 1321 of file CommandLine.h.
References llvm::Mod, and llvm::cl::applicator< Mod >::opt().
void llvm::cl::apply | ( | Opt * | O, |
const Mod & | M, | ||
const Mods &... | Ms ) |
Definition at line 1316 of file CommandLine.h.
References apply(), llvm::Mod, and llvm::cl::applicator< Mod >::opt().
Referenced by llvm::cl::alias::alias(), apply(), llvm::cl::bits< DataType, Storage, ParserClass >::bits(), llvm::cl::list< std::string, DebugCounter >::list(), and llvm::cl::opt< DataType, ExternalStorage, ParserClass >::opt().
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > llvm::cl::callback | ( | F | CB | ) |
Definition at line 525 of file CommandLine.h.
References F.
bool llvm::cl::ExpandResponseFiles | ( | StringSaver & | Saver, |
TokenizerCallback | Tokenizer, | ||
SmallVectorImpl< const char * > & | Argv ) |
A convenience helper which supports the typical use case of expansion function call.
Definition at line 1395 of file CommandLine.cpp.
References llvm::errs(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::StringSaver::getAllocator(), and llvm::toString().
Referenced by llvm::libDriverMain().
LLVM_ABI bool llvm::cl::expandResponseFiles | ( | int | Argc, |
const char *const * | Argv, | ||
const char * | EnvVar, | ||
SmallVectorImpl< const char * > & | NewArgv ) |
A convenience helper which concatenates the options specified by the environment variable EnvVar and command line options, then expands response files recursively.
References llvm::cl::SubCommand::getTopLevel(), LLVM_ABI, and llvm::Sub.
Referenced by llvm::opt::OptTable::parseArgs().
bool llvm::cl::expandResponseFiles | ( | int | Argc, |
const char *const * | Argv, | ||
const char * | EnvVar, | ||
StringSaver & | Saver, | ||
SmallVectorImpl< const char * > & | NewArgv ) |
A convenience helper which concatenates the options specified by the environment variable EnvVar and command line options, then expands response files recursively.
The tokenizer is a predefined GNU or Windows one.
Definition at line 1372 of file CommandLine.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::errs(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::StringSaver::getAllocator(), llvm::sys::Process::GetEnv(), TokenizeGNUCommandLine(), TokenizeWindowsCommandLine(), and llvm::toString().
An array of optional enabled settings in the LLVM build configuration, which may be of interest to compiler developers.
For example, includes "+assertions" if assertions are enabled. Used by printBuildConfig.
Definition at line 2749 of file CommandLine.cpp.
References llvm::ArrayRef(), and llvm::StringRef::drop_front().
Referenced by printBuildConfig().
OptionCategory & llvm::cl::getGeneralCategory | ( | ) |
Definition at line 2681 of file CommandLine.cpp.
Referenced by llvm::cl::Option::addCategory(), and llvm::cl::Option::Option().
StringMap< Option * > & llvm::cl::getRegisteredOptions | ( | SubCommand & | Sub = SubCommand::getTopLevel() | ) |
Use this to get a StringMap to all registered named options (e.g.
-help).
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 deprecated 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 2808 of file CommandLine.cpp.
References assert(), GlobalParser, initCommonOptions(), and llvm::Sub.
iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > llvm::cl::getRegisteredSubcommands | ( | ) |
Use this to get all registered SubCommands from the provided parser.
Typical usage:
This interface is useful for defining subcommands in libraries and the dispatch from a single point (like in the main function).
Definition at line 2817 of file CommandLine.cpp.
References GlobalParser.
void llvm::cl::HideUnrelatedOptions | ( | ArrayRef< const cl::OptionCategory * > | Categories, |
SubCommand & | Sub = SubCommand::getTopLevel() ) |
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 2834 of file CommandLine.cpp.
References CommonOptions, I, initCommonOptions(), llvm::is_contained(), ReallyHidden, and llvm::Sub.
void llvm::cl::HideUnrelatedOptions | ( | cl::OptionCategory & | Category, |
SubCommand & | Sub = SubCommand::getTopLevel() ) |
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 2821 of file CommandLine.cpp.
References CommonOptions, I, initCommonOptions(), ReallyHidden, and llvm::Sub.
initializer< Ty > llvm::cl::init | ( | const Ty & | Val | ) |
Definition at line 445 of file CommandLine.h.
Referenced by llvm::ApplyExtTspWithoutProfile(), llvm::ir2vec::ArgWeight(), llvm::AsmMacroMaxNestingDepth(), CheapRematWeight(), llvm::CheckBFIUnknownBlockQueries(), CopyWeight(), DEBUG_COUNTER(), llvm::DebugInfoCorrelate(), llvm::DoInstrProfNameCompression(), llvm::EmitLongStrLiterals(), llvm::EnableDetailedFunctionProperties(), llvm::EnableExtTspBlockPlacement(), llvm::EnableKnowledgeRetention(), llvm::EnableLTOInternalization(), llvm::EnableMemProfContextDisambiguation(), llvm::EvictInterferenceCutoff(), ExpensiveRematWeight(), llvm::ir2vec::IR2VecEmbeddingKind(), llvm::IterativeBFIMaxIterationsPerBlock(), llvm::IterativeBFIPrecision(), LoadWeight(), MemProfAveLifetimeColdThreshold(), MemProfKeepAllNotColdContexts(), MemProfLifetimeAccessDensityColdThreshold(), MemProfMinAveLifetimeAccessDensityHotThreshold(), MemProfUseHotHints(), llvm::NoPGOWarnMismatch(), llvm::NoPGOWarnMismatchComdatWeak(), llvm::NoWarnSampleUnused(), llvm::ir2vec::OpcWeight(), llvm::PGOWarnMissing(), llvm::PickMergedSourceLocations(), llvm::PreRADirection(), llvm::ProfileCorrelate(), llvm::ProfileInlineGrowthLimit(), llvm::ProfileInlineLimitMax(), llvm::ProfileInlineLimitMin(), llvm::ProfileLikelyProb(), llvm::ProfileSummaryCutoffCold(), llvm::ProfileSummaryCutoffHot(), llvm::ProfileSummaryHugeWorkingSetSizeThreshold(), llvm::ProfileSummaryLargeWorkingSetSizeThreshold(), llvm::codegen::RegisterCodeGenFlags::RegisterCodeGenFlags(), llvm::mc::RegisterMCTargetOptionsFlags::RegisterMCTargetOptionsFlags(), llvm::SampleColdCallSiteThreshold(), llvm::SampleHotCallSiteThreshold(), llvm::SampleProfileMaxPropagateIterations(), llvm::SampleProfileRecordCoverage(), llvm::SampleProfileSampleCoverage(), ScalePartialSampleProfileWorkingSetSize(), llvm::ShouldPreserveAllAttributes(), llvm::SortProfiledSCC(), llvm::StaticLikelyProb(), StoreWeight(), llvm::SupportsHotColdNew(), llvm::SwpEnableCopyToPhi(), llvm::SwpForceIssueWidth(), llvm::ir2vec::TypeWeight(), llvm::UseSegmentSetForPhysRegs(), and llvm::HexagonVLIWResourceModel::VLIWResourceModel().
list_initializer< Ty > llvm::cl::list_init | ( | ArrayRef< Ty > | Vals | ) |
Definition at line 450 of file CommandLine.h.
LocationClass< Ty > llvm::cl::location | ( | Ty & | L | ) |
Definition at line 465 of file CommandLine.h.
Referenced by llvm::initStatisticOptions().
bool llvm::cl::ParseCommandLineOptions | ( | int | argc, |
const char *const * | argv, | ||
StringRef | Overview = "", | ||
raw_ostream * | Errs = nullptr, | ||
vfs::FileSystem * | VFS = nullptr, | ||
const char * | EnvVar = nullptr, | ||
bool | LongOptionsUseDoubleDash = false ) |
Definition at line 1464 of file CommandLine.cpp.
References A(), llvm::sys::Process::GetEnv(), GlobalParser, I, initCommonOptions(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and TokenizeGNUCommandLine().
Referenced by llvm::handleExecNameEncodedBEOpts(), llvm::handleExecNameEncodedOptimizerOpts(), LLVMParseCommandLineOptions(), llvm::parseCommandLineOptions(), and llvm::parseFuzzerCLOpts().
void llvm::cl::printBuildConfig | ( | raw_ostream & | OS | ) |
Prints the compiler build configuration.
Designed for compiler developers, not compiler end-users. Intended to be used in –version output when enabled.
Definition at line 2787 of file CommandLine.cpp.
References getCompilerBuildConfig(), and llvm::interleaveComma().
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.
Hidden | if true will print hidden options |
Categorized | if true print options in categories |
Definition at line 2738 of file CommandLine.cpp.
References CommonOptions, and Hidden.
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 1251 of file CommandLine.h.
References llvm::Default, P, and printer.
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 1224 of file CommandLine.h.
References llvm::Default, and P.
void llvm::cl::PrintOptionValues | ( | ) |
Definition at line 2719 of file CommandLine.cpp.
References GlobalParser.
void llvm::cl::PrintVersionMessage | ( | ) |
Utility function for printing version number.
Definition at line 2796 of file CommandLine.cpp.
References CommonOptions.
Parses Arg into the option handler Handler.
Definition at line 726 of file CommandLine.cpp.
References llvm::cl::Option::ArgStr, and ProvideOption().
void llvm::cl::ResetAllOptionOccurrences | ( | ) |
Reset all command line options to a state that looks as if they have never appeared on the command line.
Reset all options at least once, so that we can parse different options.
This is useful for being able to parse a command line multiple times (especially useful for writing tests).
Definition at line 1492 of file CommandLine.cpp.
References llvm::cl::SubCommand::ConsumeAfterOpt, llvm::cl::SubCommand::OptionsMap, llvm::cl::SubCommand::PositionalOpts, llvm::cl::Option::reset(), and llvm::cl::SubCommand::SinkOpts.
void llvm::cl::ResetCommandLineParser | ( | ) |
Reset the command line parser back to its initial state.
This removes all options, categories, and subcommands and returns the parser to a state where no options are supported.
Definition at line 2849 of file CommandLine.cpp.
References GlobalParser.
void llvm::cl::SetVersionPrinter | ( | VersionPrinterTy | func | ) |
===------------------------------------------------------------------—===// 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 2800 of file CommandLine.cpp.
References CommonOptions, and func.
void llvm::cl::tokenizeConfigFile | ( | StringRef | Source, |
StringSaver & | Saver, | ||
SmallVectorImpl< const char * > & | NewArgv, | ||
bool | MarkEOLs = false ) |
Tokenizes content of configuration file.
[in] | Source | The string representing content of config file. |
[in] | Saver | Delegates back to the caller for saving parsed strings. |
[out] | NewArgv | All parsed strings are appended to NewArgv. |
[in] | MarkEOLs | Added for compatibility with TokenizerCallback. |
It works like TokenizeGNUCommandLine with ability to skip comment lines.
Definition at line 1092 of file CommandLine.cpp.
References isWhitespace(), and TokenizeGNUCommandLine().
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 840 of file CommandLine.cpp.
References llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), llvm::StringRef::data(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), I, isQuote(), isWhitespace(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::StringSaver::save(), and llvm::SmallString< InternalLen >::str().
Referenced by expandResponseFiles(), ParseCommandLineOptions(), and tokenizeConfigFile().
void llvm::cl::TokenizeWindowsCommandLine | ( | StringRef | Source, |
StringSaver & | Saver, | ||
SmallVectorImpl< const char * > & | NewArgv, | ||
bool | MarkEOLs = false ) |
Tokenizes a string of Windows command line arguments, 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
For handling a full Windows command line including the executable name at the start, see TokenizeWindowsCommandLineFull below.
[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 1060 of file CommandLine.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back(), and tokenizeWindowsCommandLineImpl().
Referenced by expandResponseFiles(), and llvm::libDriverMain().
void llvm::cl::TokenizeWindowsCommandLineFull | ( | StringRef | Source, |
StringSaver & | Saver, | ||
SmallVectorImpl< const char * > & | NewArgv, | ||
bool | MarkEOLs = false ) |
Tokenizes a Windows full command line, including command name at the start.
This uses the same syntax rules as TokenizeWindowsCommandLine for all but the first token. But the first token is expected to be parsed as the executable file name in the way CreateProcess would do it, rather than the way the C library startup code would do it: CreateProcess does not consider that \ is ever an escape character (because " is not a valid filename char, hence there's never a need to escape it to be used literally).
Parameters are the same as for TokenizeWindowsCommandLine. In particular, if you set MarkEOLs = true, then the first word of every line will be parsed using the special rules for command names, making this function suitable for parsing a file full of commands to execute.
Definition at line 1080 of file CommandLine.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back(), and tokenizeWindowsCommandLineImpl().
void llvm::cl::TokenizeWindowsCommandLineNoCopy | ( | StringRef | Source, |
StringSaver & | Saver, | ||
SmallVectorImpl< StringRef > & | NewArgv ) |
Tokenizes a Windows command line while attempting to avoid copies.
If no quoting or escaping was used, this produces substrings of the original string. If a token requires unquoting, it will be allocated with the StringSaver.
Definition at line 1072 of file CommandLine.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back(), and tokenizeWindowsCommandLineImpl().
Referenced by llvm::jitlink::COFFDirectiveParser::parse().
ValuesClass llvm::cl::values | ( | OptsTy... | Options | ) |
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to the ValuesClass constructor.
Definition at line 713 of file CommandLine.h.
References Options.
Referenced by llvm::ir2vec::IR2VecEmbeddingKind(), llvm::PreRADirection(), llvm::ProfileCorrelate(), llvm::codegen::RegisterCodeGenFlags::RegisterCodeGenFlags(), and llvm::mc::RegisterMCTargetOptionsFlags::RegisterMCTargetOptionsFlags().
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< bool > |
Definition at line 58 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< boolOrDefault > |
Definition at line 59 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< char > |
Definition at line 69 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< double > |
Definition at line 66 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< float > |
Definition at line 67 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< int > |
Definition at line 60 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< long > |
Definition at line 61 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< long long > |
Definition at line 62 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< std::string > |
Definition at line 68 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< unsigned > |
Definition at line 63 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< unsigned long > |
Definition at line 64 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::basic_parser< unsigned long long > |
Definition at line 65 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::opt< bool > |
Definition at line 79 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::opt< char > |
Definition at line 80 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::opt< int > |
Definition at line 81 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::opt< std::string > |
Definition at line 76 of file CommandLine.cpp.
template class LLVM_EXPORT_TEMPLATE llvm::cl::opt< unsigned > |
Definition at line 82 of file CommandLine.cpp.