LLVM
8.0.1
|
Option - Abstract representation for a single form of driver argument. More...
#include "llvm/Option/Option.h"
Public Member Functions | |
Option (const OptTable::Info *Info, const OptTable *Owner) | |
bool | isValid () const |
unsigned | getID () const |
OptionClass | getKind () const |
StringRef | getName () const |
Get the name of this option without any prefix. More... | |
const Option | getGroup () const |
const Option | getAlias () const |
const char * | getAliasArgs () const |
Get the alias arguments as a \0 separated list. More... | |
StringRef | getPrefix () const |
Get the default prefix for this option. More... | |
std::string | getPrefixedName () const |
Get the name of this option with the default prefix. More... | |
unsigned | getNumArgs () const |
bool | hasNoOptAsInput () const |
RenderStyleKind | getRenderStyle () const |
bool | hasFlag (unsigned Val) const |
Test if this option has the flag Val. More... | |
const Option | getUnaliasedOption () const |
getUnaliasedOption - Return the final option this option aliases (itself, if the option has no alias). More... | |
StringRef | getRenderName () const |
getRenderName - Return the name to use when rendering this option. More... | |
bool | matches (OptSpecifier ID) const |
matches - Predicate for whether this option is part of the given option (which may be a group). More... | |
Arg * | accept (const ArgList &Args, unsigned &Index, unsigned ArgSize) const |
accept - Potentially accept the current argument, returning a new Arg instance, or 0 if the option does not accept this argument (or the argument is missing values). More... | |
void | print (raw_ostream &O) const |
void | dump () const |
Protected Attributes | |
const OptTable::Info * | Info |
const OptTable * | Owner |
Option - Abstract representation for a single form of driver argument.
An Option class represents a form of option that the driver takes, for example how many arguments the option has and how they can be provided. Individual option instances store additional information about what group the option is a member of (if any), if the option is an alias, and a number of flags. At runtime the driver parses the command line into concrete Arg instances, each of which corresponds to a particular Option instance.
Option::Option | ( | const OptTable::Info * | Info, |
const OptTable * | Owner | ||
) |
Definition at line 27 of file Option.cpp.
References assert(), FlagClass, getAlias(), getAliasArgs(), getKind(), Info, and isValid().
accept - Potentially accept the current argument, returning a new Arg instance, or 0 if the option does not accept this argument (or the argument is missing values).
If the option accepts the current argument, accept() sets Index to the position where argument parsing should resume (even if the argument is missing values).
ArgSize | The number of bytes taken up by the matched Option prefix and name. This is used to determine where joined values start. |
Definition at line 110 of file Option.cpp.
References Arg, CommaJoinedClass, FlagClass, getAliasArgs(), llvm::opt::ArgList::getArgString(), getID(), getKind(), getName(), getNumArgs(), llvm::opt::ArgList::getNumInputArgStrings(), getPrefix(), getUnaliasedOption(), llvm::opt::Arg::getValues(), JoinedAndSeparateClass, JoinedClass, JoinedOrSeparateClass, llvm_unreachable, llvm::opt::ArgList::MakeArgString(), llvm::Intrinsic::memcpy, MultiArgClass, llvm::SmallVectorTemplateBase< T, bool >::push_back(), RemainingArgsClass, RemainingArgsJoinedClass, SeparateClass, and llvm::opt::Arg::setOwnsValues().
Referenced by getRenderName().
LLVM_DUMP_METHOD void Option::dump | ( | ) | const |
Definition at line 91 of file Option.cpp.
References llvm::dbgs(), and print().
Referenced by getRenderName(), and llvm::opt::OptTable::OptTable().
Definition at line 110 of file Option.h.
References llvm::opt::OptTable::Info::AliasID, assert(), and llvm::opt::OptTable::getOption().
Referenced by getUnaliasedOption(), matches(), Option(), print(), and llvm::opt::OptTable::PrintHelp().
Definition at line 104 of file Option.h.
References assert(), llvm::opt::OptTable::getOption(), and llvm::opt::OptTable::Info::GroupID.
|
inline |
Definition at line 88 of file Option.h.
References assert(), and llvm::opt::OptTable::Info::ID.
Referenced by accept(), matches(), and llvm::opt::OptTable::PrintHelp().
|
inline |
Definition at line 93 of file Option.h.
References assert(), and llvm::opt::OptTable::Info::Kind.
Referenced by accept(), getOptionHelpName(), getRenderStyle(), Option(), and print().
|
inline |
Get the name of this option without any prefix.
Definition at line 99 of file Option.h.
References assert(), and llvm::opt::OptTable::Info::Name.
Referenced by accept(), getPrefixedName(), getRenderName(), llvm::opt::DerivedArgList::MakeFlagArg(), llvm::opt::DerivedArgList::MakeJoinedArg(), llvm::opt::DerivedArgList::MakePositionalArg(), llvm::opt::DerivedArgList::MakeSeparateArg(), and print().
|
inline |
Definition at line 139 of file Option.h.
References llvm::opt::OptTable::Info::Param.
Referenced by accept(), getOptionHelpName(), and print().
|
inline |
Get the default prefix for this option.
Definition at line 127 of file Option.h.
References llvm::cl::Prefix, and llvm::opt::OptTable::Info::Prefixes.
Referenced by accept(), getPrefixedName(), llvm::opt::DerivedArgList::MakeFlagArg(), llvm::opt::DerivedArgList::MakeJoinedArg(), llvm::opt::DerivedArgList::MakePositionalArg(), and llvm::opt::DerivedArgList::MakeSeparateArg().
|
inline |
Get the name of this option with the default prefix.
Definition at line 133 of file Option.h.
References getName(), getPrefix(), and llvm::MipsISD::Ret.
Referenced by getOptionHelpName().
|
inline |
getRenderName - Return the name to use when rendering this option.
Definition at line 185 of file Option.h.
References accept(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, dump(), getName(), getUnaliasedOption(), matches(), llvm::RISCVFenceField::O, and print().
|
inline |
Definition at line 143 of file Option.h.
References CommaJoinedClass, FlagClass, llvm::opt::OptTable::Info::Flags, getKind(), GroupClass, InputClass, JoinedAndSeparateClass, JoinedClass, JoinedOrSeparateClass, llvm_unreachable, MultiArgClass, RemainingArgsClass, RemainingArgsJoinedClass, RenderCommaJoinedStyle, llvm::opt::RenderJoined, RenderJoinedStyle, llvm::opt::RenderSeparate, RenderSeparateStyle, RenderValuesStyle, SeparateClass, UnknownClass, and ValuesClass.
getUnaliasedOption - Return the final option this option aliases (itself, if the option has no alias).
Definition at line 177 of file Option.h.
References getAlias(), getUnaliasedOption(), and isValid().
Referenced by accept(), llvm::opt::ArgList::append(), getRenderName(), and getUnaliasedOption().
Test if this option has the flag Val.
Definition at line 171 of file Option.h.
References llvm::opt::OptTable::Info::Flags.
|
inline |
Definition at line 141 of file Option.h.
References llvm::opt::OptTable::Info::Flags, and llvm::opt::RenderAsInput.
|
inline |
Definition at line 84 of file Option.h.
Referenced by getUnaliasedOption(), matches(), Option(), print(), and llvm::opt::OptTable::PrintHelp().
bool Option::matches | ( | OptSpecifier | ID | ) | const |
matches - Predicate for whether this option is part of the given option (which may be a group).
Note that matches against options which are an alias should never be done – aliases do not participate in matching and so such a query will always be false.
Definition at line 94 of file Option.cpp.
References getAlias(), getGroup(), llvm::opt::OptSpecifier::getID(), getID(), isValid(), and matches().
Referenced by llvm::opt::ArgList::AddAllArgsExcept(), getRenderName(), and matches().
void Option::print | ( | raw_ostream & | O | ) | const |
Definition at line 42 of file Option.cpp.
References CommaJoinedClass, FlagClass, getAlias(), getGroup(), getKind(), getName(), getNumArgs(), GroupClass, Info, InputClass, isValid(), JoinedAndSeparateClass, JoinedClass, JoinedOrSeparateClass, MultiArgClass, P, llvm::opt::OptTable::Info::Prefixes, print(), RemainingArgsClass, RemainingArgsJoinedClass, SeparateClass, UnknownClass, and ValuesClass.
Referenced by dump(), getRenderName(), llvm::opt::Arg::print(), and print().
|
protected |