20 using namespace llvm::opt;
23 : Info(info), Owner(owner) {
28 "Multi-level aliases are not supported.");
31 assert(
getAlias().
isValid() &&
"Only alias options can have alias args.");
34 "Cannot provide alias args to a flag option.");
41 #define P(N) case N: llvm::errs() << #N; break
58 for (
const char *
const *Pre =
Info->
Prefixes; *Pre !=
nullptr; ++Pre) {
59 llvm::errs() <<
'"' << *Pre << (*(Pre + 1) ==
nullptr ?
"\"" :
"\", ");
102 unsigned ArgSize)
const {
118 Arg *
A =
new Arg(UnaliasedOption, Spelling, Index++);
121 while (*Val !=
'\0') {
125 Val += strlen(Val) + 1;
137 return new Arg(UnaliasedOption, Spelling, Index++, Value);
142 Arg *
A =
new Arg(UnaliasedOption, Spelling, Index++);
145 const char *Prev = Str;
149 if (!c || c ==
',') {
151 char *
Value =
new char[Str - Prev + 1];
152 memcpy(Value, Prev, Str - Prev);
153 Value[Str - Prev] =
'\0';
178 return new Arg(UnaliasedOption, Spelling,
201 return new Arg(*
this, Spelling, Index++, Value);
210 return new Arg(UnaliasedOption, Spelling,
220 return new Arg(UnaliasedOption, Spelling, Index - 2,
228 Arg *
A =
new Arg(UnaliasedOption, Spelling, Index++);
void push_back(const T &Elt)
bool matches(OptSpecifier ID) const
matches - Predicate for whether this option is part of the given option (which may be a group)...
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
StringRef getName() const
Get the name of this option without any prefix.
const OptTable::Info * Info
const Option getAlias() const
OptionClass getKind() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const Option getGroup() const
SmallVectorImpl< const char * > & getValues()
virtual unsigned getNumInputArgStrings() const =0
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
unsigned getNumArgs() const
Option - Abstract representation for a single form of driver argument.
A concrete instance of a particular driver option.
Provide access to the Option info table.
const char *const * Prefixes
A null terminated array of prefix strings to apply to name while matching.
const char * MakeArgString(const Twine &Str) const
StringRef getPrefix() const
Get the default prefix for this option.
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
Option(const OptTable::Info *Info, const OptTable *Owner)
Defines the llvm::Arg class for parsed arguments.
void setOwnsValues(bool Value) const
const Option getUnaliasedOption() const
getUnaliasedOption - Return the final option this option aliases (itself, if the option has no alias)...
OptSpecifier - Wrapper class for abstracting references to option IDs.
Entry for a single option instance in the option data table.
const char * getAliasArgs() const
Get the alias arguments as a \0 separated list.
LLVM Value Representation.
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 do...
StringRef - Represent a constant reference to a string, i.e.
ArgList - Ordered collection of driver arguments.