20 using namespace llvm::opt;
22 void arg_iterator::SkipToNextArg() {
23 for (; Current != Args.
end(); ++Current) {
29 const Option &O = (*Current)->getOption();
50 if ((*it)->getOption().matches(Id))
58 if ((*it)->getOption().matches(Id0) ||
59 (*it)->getOption().matches(Id1))
68 if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
69 (*it)->getOption().matches(Id2))
78 if ((*it)->getOption().matches(Id0) || (*it)->getOption().matches(Id1) ||
79 (*it)->getOption().matches(Id2) || (*it)->getOption().matches(Id3))
87 if ((*it)->getOption().matches(Id)) {
99 if ((*it)->getOption().matches(Id0) ||
100 (*it)->getOption().matches(Id1)) {
114 if ((*it)->getOption().matches(Id0) ||
115 (*it)->getOption().matches(Id1) ||
116 (*it)->getOption().matches(Id2)) {
129 if ((*it)->getOption().matches(Id0) ||
130 (*it)->getOption().matches(Id1) ||
131 (*it)->getOption().matches(Id2) ||
132 (*it)->getOption().matches(Id3)) {
146 if ((*it)->getOption().matches(Id0) ||
147 (*it)->getOption().matches(Id1) ||
148 (*it)->getOption().matches(Id2) ||
149 (*it)->getOption().matches(Id3) ||
150 (*it)->getOption().matches(Id4)) {
164 if ((*it)->getOption().matches(Id0) ||
165 (*it)->getOption().matches(Id1) ||
166 (*it)->getOption().matches(Id2) ||
167 (*it)->getOption().matches(Id3) ||
168 (*it)->getOption().matches(Id4) ||
169 (*it)->getOption().matches(Id5)) {
184 if ((*it)->getOption().matches(Id0) ||
185 (*it)->getOption().matches(Id1) ||
186 (*it)->getOption().matches(Id2) ||
187 (*it)->getOption().matches(Id3) ||
188 (*it)->getOption().matches(Id4) ||
189 (*it)->getOption().matches(Id5) ||
190 (*it)->getOption().matches(Id6)) {
205 if ((*it)->getOption().matches(Id0) ||
206 (*it)->getOption().matches(Id1) ||
207 (*it)->getOption().matches(Id2) ||
208 (*it)->getOption().matches(Id3) ||
209 (*it)->getOption().matches(Id4) ||
210 (*it)->getOption().matches(Id5) ||
211 (*it)->getOption().matches(Id6) ||
212 (*it)->getOption().matches(Id7)) {
223 return A->getOption().matches(Pos);
228 bool Default)
const {
230 return A->getOption().matches(Pos) ||
A->getOption().matches(PosAlias);
237 return A->getValue();
244 return std::vector<std::string>(Values.
begin(), Values.
end());
250 A->render(*
this, Output);
258 A->render(*
this, Output);
265 for (
const Arg *
Arg : Args) {
266 bool Excluded =
false;
307 Output.
append(Values.begin(), Values.end());
312 const char *Translation,
334 if (!(*it)->isClaimed())
350 for (
Arg *
A : *
this) {
360 void InputArgList::releaseMemory() {
367 const char*
const *ArgEnd)
368 : NumInputArgStrings(ArgEnd - ArgBegin) {
369 ArgStrings.
append(ArgBegin, ArgEnd);
373 unsigned Index = ArgStrings.
size();
376 SynthesizedStrings.push_back(String0);
377 ArgStrings.
push_back(SynthesizedStrings.back().c_str());
386 assert(Index0 + 1 == Index1 &&
"Unexpected non-consecutive indices!");
398 : BaseArgs(BaseArgs) {}
405 SynthesizedArgs.push_back(std::unique_ptr<Arg>(A));
409 SynthesizedArgs.push_back(
412 return SynthesizedArgs.back().get();
417 unsigned Index = BaseArgs.
MakeIndex(Value);
418 SynthesizedArgs.push_back(
421 return SynthesizedArgs.back().get();
427 SynthesizedArgs.push_back(
430 return SynthesizedArgs.back().get();
436 SynthesizedArgs.push_back(make_unique<Arg>(
439 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)...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
const Option & getOption() const
StringRef getName() const
Get the name of this option without any prefix.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
auto remove_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly...
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...
Arg * MakeFlagArg(const Arg *BaseArg, const Option Opt) const
MakeFlagArg - Construct a new FlagArg for the given option Id.
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()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
void print(raw_ostream &O) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void AddAllArgs(ArgStringList &Output, ArrayRef< OptSpecifier > Ids) const
AddAllArgs - Render all arguments matching any of the given ids.
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.
void print(raw_ostream &O) const
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
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(const_iterator CI)
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.
void AddAllArgsExcept(ArgStringList &Output, ArrayRef< OptSpecifier > Ids, ArrayRef< OptSpecifier > ExcludeIds) const
AddAllArgsExcept - Render all arguments matching any of the given ids and not matching any of the exc...
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...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
OptSpecifier - Wrapper class for abstracting references to option IDs.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Arg * getLastArg(OptSpecifier Id) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")