#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include <iostream>
#include <sstream>
#include <cerrno>
#include <cstdlib>
Classes | |
class | anonymous_namespace{CommandLine.cpp}::HelpPrinter |
class | anonymous_namespace{CommandLine.cpp}::VersionPrinter |
Namespaces | |
namespace | llvm |
namespace | llvm::cl |
cl Namespace - This namespace contains all of the command line option processing machinery. | |
namespace | anonymous_namespace{CommandLine.cpp} |
Defines | |
#define | PRINT_OPT_DIFF(T) |
Functions | |
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 >) | |
std::string | getIndent (int n) |
static void | GetOptionInfo (SmallVectorImpl< Option * > &PositionalOpts, SmallVectorImpl< Option * > &SinkOpts, StringMap< Option * > &OptionsMap) |
GetOptionInfo - Scan the list of registered options, turning them into data structures that are easier to handle. | |
static Option * | LookupOption (StringRef &Arg, StringRef &Value, const StringMap< Option * > &OptionsMap) |
LookupOption - Lookup the option specified by the specified option on the command line. | |
static Option * | LookupNearestOption (StringRef Arg, const StringMap< Option * > &OptionsMap, std::string &NearestString) |
LookupNearestOption - Lookup the closest match to the option specified by the specified option on the command line. | |
static bool | CommaSeparateAndAddOccurence (Option *Handler, unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false) |
CommaSeparateAndAddOccurence - A wrapper around Handler->addOccurence() that does special handling of cl::CommaSeparated options. | |
static bool | ProvideOption (Option *Handler, StringRef ArgName, StringRef Value, int argc, char **argv, int &i) |
ProvideOption - For Value, this differentiates between an empty value ("") and a null value (StringRef()). | |
static bool | ProvidePositionalOption (Option *Handler, StringRef Arg, int i) |
static bool | isGrouping (const Option *O) |
static bool | isPrefixedOrGrouping (const Option *O) |
static Option * | getOptionPred (StringRef Name, size_t &Length, bool(*Pred)(const Option *), const StringMap< Option * > &OptionsMap) |
static Option * | HandlePrefixedOrGroupedOption (StringRef &Arg, StringRef &Value, bool &ErrorParsing, const StringMap< Option * > &OptionsMap) |
HandlePrefixedOrGroupedOption - The specified argument string (which started with at least one '-') does not fully match an available option. | |
static bool | RequiresValue (const Option *O) |
static bool | EatsUnboundedNumberOfValues (const Option *O) |
static void | ParseCStringVector (std::vector< char * > &OutputVector, const char *Input) |
ParseCStringVector - Break INPUT up wherever one or more whitespace characters are found, and store the resulting tokens in OUTPUT. | |
static const char * | getValueStr (const Option &O, const char *DefaultMsg) |
static bool | parseDouble (Option &O, StringRef Arg, double &Value) |
static int | OptNameCompare (const void *LHS, const void *RHS) |
static void | sortOpts (StringMap< Option * > &OptMap, SmallVectorImpl< std::pair< const char *, Option * > > &Opts, bool ShowHidden) |
static HelpPrinter | NormalPrinter (false) |
static HelpPrinter | HiddenPrinter (true) |
Variables | |
static std::vector< const char * > | MoreHelp |
static bool | OptionListChanged = false |
static Option * | RegisteredOptionList = 0 |
RegisteredOptionList - This is the list of the command line options that have statically constructed themselves. | |
static const size_t | MaxOptWidth = 8 |
static cl::opt< HelpPrinter, true, parser< bool > > | HOp ("help", cl::desc("Display available options (-help-hidden for more)"), cl::location(NormalPrinter), cl::ValueDisallowed) |
static cl::opt< HelpPrinter, true, parser< bool > > | HHOp ("help-hidden", cl::desc("Display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed) |
static cl::opt< bool > | PrintOptions ("print-options", cl::desc("Print non-default options after command line parsing"), cl::Hidden, cl::init(false)) |
static cl::opt< bool > | PrintAllOptions ("print-all-options", cl::desc("Print all option values after command line parsing"), cl::Hidden, cl::init(false)) |
static void(* | OverrideVersionPrinter )()=0 |
static std::vector< void(*)()> * | ExtraVersionPrinters = 0 |
static VersionPrinter | VersionPrinterInstance |
static cl::opt< VersionPrinter, true, parser< bool > > | VersOp ("version", cl::desc("Display the version of this program"), cl::location(VersionPrinterInstance), cl::ValueDisallowed) |
#define PRINT_OPT_DIFF | ( | T | ) |
void parser<T>:: \ printOptionDiff(const Option &O, T V, OptionValue<T> D, \ size_t GlobalWidth) const { \ printOptionName(O, GlobalWidth); \ std::stringstream Str; \ Str << V; \ std::cout << "= " << Str.str(); \ size_t NumSpaces = MaxOptWidth > Str.str().size() ? MaxOptWidth - Str.str().size() : 0; \ std::cout << getIndent(NumSpaces) << " (default: "; \ if (D.hasValue()) \ std::cout << D.getValue(); \ else \ std::cout << "*no default*"; \ std::cout << ")\n"; \ } \
static bool CommaSeparateAndAddOccurence | ( | Option * | Handler, | |
unsigned | pos, | |||
StringRef | ArgName, | |||
StringRef | Value, | |||
bool | MultiArg = false | |||
) | [static] |
CommaSeparateAndAddOccurence - A wrapper around Handler->addOccurence() that does special handling of cl::CommaSeparated options.
static bool EatsUnboundedNumberOfValues | ( | const Option * | O | ) | [static] |
std::string getIndent | ( | int | n | ) |
static void GetOptionInfo | ( | SmallVectorImpl< Option * > & | PositionalOpts, | |
SmallVectorImpl< Option * > & | SinkOpts, | |||
StringMap< Option * > & | OptionsMap | |||
) | [static] |
GetOptionInfo - Scan the list of registered options, turning them into data structures that are easier to handle.
static Option* getOptionPred | ( | StringRef | Name, | |
size_t & | Length, | |||
bool(*)(const Option *) | Pred, | |||
const StringMap< Option * > & | OptionsMap | |||
) | [static] |
static const char* getValueStr | ( | const Option & | O, | |
const char * | DefaultMsg | |||
) | [static] |
static Option* HandlePrefixedOrGroupedOption | ( | StringRef & | Arg, | |
StringRef & | Value, | |||
bool & | ErrorParsing, | |||
const StringMap< Option * > & | OptionsMap | |||
) | [static] |
HandlePrefixedOrGroupedOption - The specified argument string (which started with at least one '-') does not fully match an available option.
Check to see if this is a prefix or grouped option. If so, split arg into output an Arg/Value pair and return the Option to parse it with.
static HelpPrinter HiddenPrinter | ( | true | ) | [static] |
static bool isGrouping | ( | const Option * | O | ) | [inline, static] |
static bool isPrefixedOrGrouping | ( | const Option * | O | ) | [inline, static] |
static Option* LookupNearestOption | ( | StringRef | Arg, | |
const StringMap< Option * > & | OptionsMap, | |||
std::string & | NearestString | |||
) | [static] |
LookupNearestOption - Lookup the closest match to the option specified by the specified option on the command line.
If there is a value specified (after an equal sign) return that as well. This assumes that leading dashes have already been stripped.
static Option* LookupOption | ( | StringRef & | Arg, | |
StringRef & | Value, | |||
const StringMap< Option * > & | OptionsMap | |||
) | [static] |
LookupOption - Lookup the option specified by the specified option on the command line.
If there is a value specified (after an equal sign) return that as well. This assumes that leading dashes have already been stripped.
static HelpPrinter NormalPrinter | ( | false | ) | [static] |
static int OptNameCompare | ( | const void * | LHS, | |
const void * | RHS | |||
) | [static] |
static void ParseCStringVector | ( | std::vector< char * > & | OutputVector, | |
const char * | Input | |||
) | [static] |
ParseCStringVector - Break INPUT up wherever one or more whitespace characters are found, and store the resulting tokens in OUTPUT.
The tokens stored in OUTPUT are dynamically allocated using strdup(), so it is the caller's responsibility to free() them later.
static bool ProvideOption | ( | Option * | Handler, | |
StringRef | ArgName, | |||
StringRef | Value, | |||
int | argc, | |||
char ** | argv, | |||
int & | i | |||
) | [inline, static] |
ProvideOption - For Value, this differentiates between an empty value ("") and a null value (StringRef()).
The later is accepted for arguments that don't allow a value (-foo) the former is rejected (-foo=).
static bool RequiresValue | ( | const Option * | O | ) | [static] |
static void sortOpts | ( | StringMap< Option * > & | OptMap, | |
SmallVectorImpl< std::pair< const char *, Option * > > & | Opts, | |||
bool | ShowHidden | |||
) | [static] |
std::vector<void (*)()>* ExtraVersionPrinters = 0 [static] |
cl::opt<HelpPrinter, true, parser<bool> > HHOp("help-hidden", cl::desc("Display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed) [static] |
cl::opt<HelpPrinter, true, parser<bool> > HOp("help", cl::desc("Display available options (-help-hidden for more)"), cl::location(NormalPrinter), cl::ValueDisallowed) [static] |
const size_t MaxOptWidth = 8 [static] |
std::vector<const char*> MoreHelp [static] |
bool OptionListChanged = false [static] |
void(* OverrideVersionPrinter)()=0 [static] |
cl::opt<bool> PrintAllOptions("print-all-options", cl::desc("Print all option values after command line parsing"), cl::Hidden, cl::init(false)) [static] |
cl::opt<bool> PrintOptions("print-options", cl::desc("Print non-default options after command line parsing"), cl::Hidden, cl::init(false)) [static] |
Option* RegisteredOptionList = 0 [static] |
RegisteredOptionList - This is the list of the command line options that have statically constructed themselves.
VersionPrinter VersionPrinterInstance [static] |
cl::opt<VersionPrinter, true, parser<bool> > VersOp("version", cl::desc("Display the version of this program"), cl::location(VersionPrinterInstance), cl::ValueDisallowed) [static] |