19 using namespace llvm::opt;
21 void arg_iterator::SkipToNextArg() {
22 for (; Current != Args.
end(); ++Current) {
28 const Option &O = (*Current)->getOption();
49 if ((*it)->getOption().matches(Id))
57 if ((*it)->getOption().matches(Id0) ||
58 (*it)->getOption().matches(Id1))
67 if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
68 (*it)->getOption().matches(Id2))
77 if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
78 (*it)->getOption().matches(Id2) || (*it)->getOption().matches(Id3))
86 if ((*it)->getOption().matches(Id)) {
98 if ((*it)->getOption().matches(Id0) ||
99 (*it)->getOption().matches(Id1)) {
113 if ((*it)->getOption().matches(Id0) ||
114 (*it)->getOption().matches(Id1) ||
115 (*it)->getOption().matches(Id2)) {
128 if ((*it)->getOption().matches(Id0) ||
129 (*it)->getOption().matches(Id1) ||
130 (*it)->getOption().matches(Id2) ||
131 (*it)->getOption().matches(Id3)) {
145 if ((*it)->getOption().matches(Id0) ||
146 (*it)->getOption().matches(Id1) ||
147 (*it)->getOption().matches(Id2) ||
148 (*it)->getOption().matches(Id3) ||
149 (*it)->getOption().matches(Id4)) {
163 if ((*it)->getOption().matches(Id0) ||
164 (*it)->getOption().matches(Id1) ||
165 (*it)->getOption().matches(Id2) ||
166 (*it)->getOption().matches(Id3) ||
167 (*it)->getOption().matches(Id4) ||
168 (*it)->getOption().matches(Id5)) {
183 if ((*it)->getOption().matches(Id0) ||
184 (*it)->getOption().matches(Id1) ||
185 (*it)->getOption().matches(Id2) ||
186 (*it)->getOption().matches(Id3) ||
187 (*it)->getOption().matches(Id4) ||
188 (*it)->getOption().matches(Id5) ||
189 (*it)->getOption().matches(Id6)) {
204 if ((*it)->getOption().matches(Id0) ||
205 (*it)->getOption().matches(Id1) ||
206 (*it)->getOption().matches(Id2) ||
207 (*it)->getOption().matches(Id3) ||
208 (*it)->getOption().matches(Id4) ||
209 (*it)->getOption().matches(Id5) ||
210 (*it)->getOption().matches(Id6) ||
211 (*it)->getOption().matches(Id7)) {
222 return A->getOption().matches(Pos);
229 return A->getOption().matches(Pos) ||
A->getOption().matches(PosAlias);
236 return A->getValue();
243 return std::vector<std::string>(Values.
begin(), Values.
end());
249 A->render(*
this, Output);
257 A->render(*
this, Output);
274 Output.
append(Values.begin(), Values.end());
279 const char *Translation,
301 if (!(*it)->isClaimed())
318 void InputArgList::releaseMemory() {
325 const char*
const *ArgEnd)
326 : NumInputArgStrings(ArgEnd - ArgBegin) {
327 ArgStrings.
append(ArgBegin, ArgEnd);
331 unsigned Index = ArgStrings.
size();
334 SynthesizedStrings.push_back(String0);
335 ArgStrings.
push_back(SynthesizedStrings.back().c_str());
344 assert(Index0 + 1 == Index1 &&
"Unexpected non-consecutive indices!");
356 : BaseArgs(BaseArgs) {}
363 SynthesizedArgs.push_back(std::unique_ptr<Arg>(A));
367 SynthesizedArgs.push_back(
370 return SynthesizedArgs.back().get();
375 unsigned Index = BaseArgs.
MakeIndex(Value);
376 SynthesizedArgs.push_back(
379 return SynthesizedArgs.back().get();
385 SynthesizedArgs.push_back(
388 return SynthesizedArgs.back().get();
394 SynthesizedArgs.push_back(make_unique<Arg>(
397 return SynthesizedArgs.back().get();
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)...
const Option & getOption() const
StringRef getName() const
Get the name of this option without any prefix.
size_t size() const
size - Get the string size.
void AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined=false) const
AddAllArgsTranslated - Render all the arguments matching the given ids, but forced to separate args a...
bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Arg * MakeFlagArg(const Arg *BaseArg, const Option Opt) const
MakeFlagArg - Construct a new FlagArg for the given option Id.
void AddAllArgs(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
AddAllArgs - Render all arguments matching the given ids.
arglist_type::const_reverse_iterator const_reverse_iterator
void eraseArg(OptSpecifier Id)
eraseArg - Remove any option matching Id.
const char * getValue(unsigned N=0) const
reverse_iterator rbegin()
SmallVectorImpl< const char * > & getValues()
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void AddSynthesizedArg(Arg *A)
AddSynthesizedArg - Add a argument to the list of synthesized arguments (to be freed).
Arg * getLastArgNoClaim(OptSpecifier Id) const
getLastArg - Return the last argument matching Id, or null.
const char * MakeArgStringRef(StringRef Str) const override
Construct a constant string pointer whose lifetime will match that of the ArgList.
Option - Abstract representation for a single form of driver argument.
A concrete instance of a particular driver option.
DerivedArgList(const InputArgList &BaseArgs)
Construct a new derived arg list from BaseArgs.
void claim() const
Set the Arg claimed bit.
const char * GetOrMakeJoinedArgString(unsigned Index, StringRef LHS, StringRef RHS) const
Create an arg string for (LHS + RHS), reusing the string at Index if possible.
bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default=true) const
hasFlag - Given an option Pos and its negative form Neg, return true if the option is present...
const char * MakeArgString(const Twine &Str) const
StringRef getPrefix() const
Get the default prefix for this option.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
iterator erase(iterator I)
iterator_range< arg_iterator > filtered(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const
AddLastArg - Render only the last argument match Id0, if present.
void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
AddAllArgValues - Render the argument values of all arguments matching the given ids.
void render(const ArgList &Args, ArgStringList &Output) const
Append the argument onto the given array as strings.
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
Arg * MakeJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value...
Defines the llvm::Arg class for parsed arguments.
Arg * MakeSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value...
Arg * MakePositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakePositionalArg - Construct a new Positional arg for the given option Id, with the provided Value...
void ClaimAllArgs() const
ClaimAllArgs - Claim all arguments.
void append(Arg *A)
append - Append A to the arg list.
OptSpecifier - Wrapper class for abstracting references to option IDs.
Arg * getLastArg(OptSpecifier Id) const
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
LLVM Value Representation.
StringRef - Represent a constant reference to a string, i.e.
StringRef getLastArgValue(OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.