10 #ifndef LLVM_OPTION_ARGLIST_H
11 #define LLVM_OPTION_ARGLIST_H
60 : Current(it), Args(Args), Id0(Id0), Id1(Id1), Id2(Id2) {
64 operator const Arg*() {
return *Current; }
81 return LHS.Current == RHS.Current;
118 Args = std::move(RHS.Args);
221 virtual const char *
getArgString(
unsigned Index)
const = 0;
255 bool Default =
true)
const;
285 const char *Translation,
286 bool Joined =
false)
const;
333 mutable std::list<std::string> SynthesizedStrings;
336 unsigned NumInputArgStrings;
339 void releaseMemory();
342 InputArgList(
const char*
const *ArgBegin,
const char*
const *ArgEnd);
344 :
ArgList(std::move(RHS)), ArgStrings(std::move(RHS.ArgStrings)),
345 SynthesizedStrings(std::move(RHS.SynthesizedStrings)),
346 NumInputArgStrings(RHS.NumInputArgStrings) {}
350 ArgStrings = std::move(RHS.ArgStrings);
351 SynthesizedStrings = std::move(RHS.SynthesizedStrings);
352 NumInputArgStrings = RHS.NumInputArgStrings;
358 return ArgStrings[Index];
362 return NumInputArgStrings;
const_reverse_iterator rend() const
std::reverse_iterator< iterator > reverse_iterator
arg_iterator operator++(int)
void AddSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value and ...
bool hasArgNoClaim(OptSpecifier Id) const
hasArg - Does the arg list contain any option matching Id.
virtual const char * MakeArgStringRef(StringRef Str) const =0
Construct a constant string pointer whose lifetime will match that of the ArgList.
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_iterator const_iterator
const InputArgList & getBaseArgs() const
arglist_type::const_reverse_iterator const_reverse_iterator
void eraseArg(OptSpecifier Id)
eraseArg - Remove any option matching Id.
reverse_iterator rbegin()
const char * getArgString(unsigned Index) const override
getArgString - Return the input argument string at Index.
unsigned getNumInputArgStrings() const override
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
void AddFlagArg(const Arg *BaseArg, const Option Opt)
AddFlagArg - Construct a new FlagArg for the given option Id and append it to the argument list...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
arg_iterator - Iterates through arguments stored inside an ArgList.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
arglist_type::iterator iterator
virtual unsigned getNumInputArgStrings() const =0
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
bool hasArg(OptSpecifier Id) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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.
arg_iterator filtered_end() const
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()
bool hasArg(OptSpecifier Id0, OptSpecifier Id1) const
const arglist_type & getArgs() const
arg_iterator & operator++()
const char * GetOrMakeJoinedArgString(unsigned Index, StringRef LHS, StringRef RHS) const
Create an arg string for (LHS + RHS), reusing the string at Index if possible.
reference operator*() const
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
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.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
ArgList & operator=(ArgList &&RHS)
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.
bool hasArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const
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...
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
void AddPositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddPositionalArg - Construct a new Positional arg for the given option Id, with the provided Value an...
std::reverse_iterator< const_iterator > const_reverse_iterator
A range adaptor for a pair of iterators.
Defines the llvm::Arg class for parsed arguments.
arglist_type::reverse_iterator reverse_iterator
friend bool operator!=(arg_iterator LHS, arg_iterator RHS)
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...
friend bool operator==(arg_iterator LHS, arg_iterator RHS)
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...
const_iterator end() const
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.
arg_iterator(SmallVectorImpl< Arg * >::const_iterator it, const ArgList &Args, OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U)
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Arg * getLastArg(OptSpecifier Id) const
reverse_iterator rbegin()
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
LLVM Value Representation.
const_iterator begin() const
arg_iterator filtered_begin(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
pointer operator->() const
This class implements an extremely fast bulk output stream that can only output to a stream...
DerivedArgList - An ordered collection of driver arguments, whose storage may be in another argument ...
StringRef - Represent a constant reference to a string, i.e.
ArgList - Ordered collection of driver arguments.
std::ptrdiff_t difference_type
StringRef getLastArgValue(OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.
const_reverse_iterator rbegin() const
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
void AddJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value and ap...
SmallVector< Arg *, 16 > arglist_type
std::forward_iterator_tag iterator_category