LLVM API Documentation
Provide access to the Option info table. More...
#include <OptTable.h>
Classes | |
struct | Info |
Entry for a single option instance in the option data table. More... | |
Public Member Functions | |
~OptTable () | |
unsigned | getNumOptions () const |
Return the total number of option classes. | |
const Option | getOption (OptSpecifier Opt) const |
Get the given Opt's Option instance, lazily creating it if necessary. | |
const char * | getOptionName (OptSpecifier id) const |
Lookup the name of the given option. | |
unsigned | getOptionKind (OptSpecifier id) const |
Get the kind of the given option. | |
unsigned | getOptionGroupID (OptSpecifier id) const |
Get the group id for the given option. | |
const char * | getOptionHelpText (OptSpecifier id) const |
Get the help text to use to describe this option. | |
const char * | getOptionMetaVar (OptSpecifier id) const |
Get the meta-variable name to use when describing this options values in the help text. | |
Arg * | ParseOneArg (const ArgList &Args, unsigned &Index, unsigned FlagsToInclude=0, unsigned FlagsToExclude=0) const |
Parse a single argument; returning the new argument and updating Index. | |
InputArgList * | ParseArgs (const char *const *ArgBegin, const char *const *ArgEnd, unsigned &MissingArgIndex, unsigned &MissingArgCount, unsigned FlagsToInclude=0, unsigned FlagsToExclude=0) const |
Parse an list of arguments into an InputArgList. | |
void | PrintHelp (raw_ostream &OS, const char *Name, const char *Title, unsigned FlagsToInclude, unsigned FlagsToExclude) const |
Render the help text for an option table. | |
void | PrintHelp (raw_ostream &OS, const char *Name, const char *Title, bool ShowHidden=false) const |
Protected Member Functions | |
OptTable (const Info *_OptionInfos, unsigned _NumOptionInfos, bool _IgnoreCase=false) |
Provide access to the Option info table.
The OptTable class provides a layer of indirection which allows Option instance to be created lazily. In the common case, only a few options will be needed at runtime; the OptTable class maintains enough information to parse command lines without instantiating Options, while letting other parts of the driver still use Option instances where convenient.
Definition at line 31 of file OptTable.h.
OptTable::OptTable | ( | const Info * | _OptionInfos, |
unsigned | _NumOptionInfos, | ||
bool | _IgnoreCase = false |
||
) | [protected] |
Definition at line 87 of file OptTable.cpp.
References llvm::StringRef::begin(), llvm::StringMap< ValueTy, AllocatorTy >::begin(), llvm::CallingConv::C, llvm::WinEH::CE, llvm::opt::Option::dump(), llvm::StringRef::end(), llvm::StringMap< ValueTy, AllocatorTy >::end(), getNumOptions(), getOption(), llvm::opt::Option::GroupClass, I, llvm::opt::OptTable::Info::ID, llvm::opt::Option::InputClass, llvm::StringSet< AllocatorTy >::insert(), llvm::opt::OptTable::Info::Kind, llvm_unreachable, P, llvm::cl::Prefix, and llvm::opt::Option::UnknownClass.
Definition at line 157 of file OptTable.cpp.
unsigned llvm::opt::OptTable::getNumOptions | ( | ) | const [inline] |
Return the total number of option classes.
Definition at line 82 of file OptTable.h.
Referenced by getOption(), OptTable(), ParseOneArg(), and PrintHelp().
const Option OptTable::getOption | ( | OptSpecifier | Opt | ) | const |
Get the given Opt's Option instance, lazily creating it if necessary.
Definition at line 160 of file OptTable.cpp.
References llvm::opt::OptSpecifier::getID(), and getNumOptions().
Referenced by llvm::opt::Option::getAlias(), llvm::opt::Option::getGroup(), getOptionHelpName(), OptTable(), and ParseOneArg().
unsigned llvm::opt::OptTable::getOptionGroupID | ( | OptSpecifier | id | ) | const [inline] |
Get the group id for the given option.
Definition at line 101 of file OptTable.h.
References llvm::opt::OptTable::Info::GroupID.
Referenced by getOptionHelpGroup().
const char* llvm::opt::OptTable::getOptionHelpText | ( | OptSpecifier | id | ) | const [inline] |
Get the help text to use to describe this option.
Definition at line 106 of file OptTable.h.
References llvm::opt::OptTable::Info::HelpText.
Referenced by getOptionHelpGroup(), and PrintHelp().
unsigned llvm::opt::OptTable::getOptionKind | ( | OptSpecifier | id | ) | const [inline] |
Get the kind of the given option.
Definition at line 96 of file OptTable.h.
References llvm::opt::OptTable::Info::Kind.
Referenced by PrintHelp().
const char* llvm::opt::OptTable::getOptionMetaVar | ( | OptSpecifier | id | ) | const [inline] |
Get the meta-variable name to use when describing this options values in the help text.
Definition at line 112 of file OptTable.h.
References llvm::opt::OptTable::Info::MetaVar.
Referenced by getOptionHelpName().
const char* llvm::opt::OptTable::getOptionName | ( | OptSpecifier | id | ) | const [inline] |
Lookup the name of the given option.
Definition at line 91 of file OptTable.h.
References llvm::opt::OptTable::Info::Name.
InputArgList * OptTable::ParseArgs | ( | const char *const * | ArgBegin, |
const char *const * | ArgEnd, | ||
unsigned & | MissingArgIndex, | ||
unsigned & | MissingArgCount, | ||
unsigned | FlagsToInclude = 0 , |
||
unsigned | FlagsToExclude = 0 |
||
) | const |
Parse an list of arguments into an InputArgList.
The resulting InputArgList will reference the strings in [ArgBegin
, ArgEnd
), and their lifetime should extend past that of the returned InputArgList.
The only error that can occur in this routine is if an argument is missing values; in this case MissingArgCount
will be non-zero.
ArgBegin | - The beginning of the argument vector. |
ArgEnd | - The end of the argument vector. |
MissingArgIndex | - On error, the index of the option which could not be parsed. |
MissingArgCount | - On error, the number of missing options. |
FlagsToInclude | - Only parse options with any of these flags. Zero is the default which includes all flags. |
FlagsToExclude | - Don't parse options with this flag. Zero is the default and means exclude nothing. |
Definition at line 254 of file OptTable.cpp.
References llvm::ARM_PROC::A, llvm::opt::ArgList::append(), llvm::opt::InputArgList::getArgString(), and ParseOneArg().
Arg * OptTable::ParseOneArg | ( | const ArgList & | Args, |
unsigned & | Index, | ||
unsigned | FlagsToInclude = 0 , |
||
unsigned | FlagsToExclude = 0 |
||
) | const |
Parse a single argument; returning the new argument and updating Index.
[in,out] | Index | - The current parsing position in the argument string list; on return this will be the index of the next argument string to parse. |
[in] | FlagsToInclude | - Only parse options with any of these flags. Zero is the default which includes all flags. |
[in] | FlagsToExclude | - Don't parse options with this flag. Zero is the default and means exclude nothing. |
Definition at line 195 of file OptTable.cpp.
References llvm::ARM_PROC::A, llvm::opt::Option::accept(), llvm::StringRef::data(), llvm::opt::ArgList::getArgString(), getNumOptions(), getOption(), llvm::opt::Option::hasFlag(), isInput(), llvm::StringRef::ltrim(), matchOption(), and Name.
Referenced by ParseArgs().
void OptTable::PrintHelp | ( | raw_ostream & | OS, |
const char * | Name, | ||
const char * | Title, | ||
unsigned | FlagsToInclude, | ||
unsigned | FlagsToExclude | ||
) | const |
Render the help text for an option table.
OS | - The stream to write the help text to. |
Name | - The name to use in the usage line. |
Title | - The title to use in the usage line. |
FlagsToInclude | - If non-zero, only include options with any of these flags set. |
FlagsToExclude | - Exclude options with any of these flags set. |
Definition at line 398 of file OptTable.cpp.
References llvm::sys::path::begin(), llvm::sys::path::const_iterator::end, llvm::opt::OptTable::Info::Flags, llvm::raw_ostream::flush(), getNumOptions(), getOptionHelpGroup(), getOptionHelpName(), getOptionHelpText(), getOptionKind(), llvm::opt::Option::GroupClass, llvm::tgtok::Id, and PrintHelpOptionList().
Referenced by PrintHelp().
void OptTable::PrintHelp | ( | raw_ostream & | OS, |
const char * | Name, | ||
const char * | Title, | ||
bool | ShowHidden = false |
||
) | const |
Definition at line 391 of file OptTable.cpp.
References llvm::opt::HelpHidden, and PrintHelp().