Go to the documentation of this file.
15 #include "llvm/Config/llvm-config.h"
37 for (
Option O = A->getOption().getUnaliasedOption();
O.isValid();
40 OptRanges.
insert(std::make_pair(
O.getID(), emptyRange())).first->second;
41 R.first = std::min<unsigned>(R.first, Args.size() - 1);
42 R.second = Args.size();
51 Arg **ArgsBegin = Args.data();
52 ArgsBegin[&A - ArgsBegin] =
nullptr;
58 ArgList::getRange(std::initializer_list<OptSpecifier> Ids)
const {
59 OptRange R = emptyRange();
61 auto I = OptRanges.
find(
Id.getID());
62 if (
I != OptRanges.
end()) {
63 R.first =
std::min(R.first,
I->second.first);
64 R.second =
std::max(R.second,
I->second.second);
75 return A->getOption().matches(Pos);
82 return A->getOption().matches(Pos) || A->getOption().matches(PosAlias);
95 return std::vector<std::string>(Values.begin(), Values.end());
101 if (A->getOption().matches(Pos))
102 A->render(*
this, Output);
108 for (
const Arg *
Arg : *
this) {
109 bool Excluded =
false;
150 Output.append(Values.begin(), Values.end());
155 const char *Translation,
164 Output.push_back(Translation);
176 for (
auto *
Arg : *
this)
193 for (
Arg *A : *
this) {
199 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
203 void InputArgList::releaseMemory() {
210 const char*
const *ArgEnd)
211 : NumInputArgStrings(ArgEnd - ArgBegin) {
212 ArgStrings.
append(ArgBegin, ArgEnd);
216 unsigned Index = ArgStrings.size();
219 SynthesizedStrings.push_back(std::string(String0));
220 ArgStrings.push_back(SynthesizedStrings.back().c_str());
229 assert(Index0 + 1 == Index1 &&
"Unexpected non-consecutive indices!");
239 : BaseArgs(BaseArgs) {}
246 SynthesizedArgs.push_back(std::unique_ptr<Arg>(A));
250 SynthesizedArgs.push_back(
253 return SynthesizedArgs.back().get();
259 SynthesizedArgs.push_back(
262 return SynthesizedArgs.back().get();
268 SynthesizedArgs.push_back(
271 return SynthesizedArgs.back().get();
277 SynthesizedArgs.push_back(std::make_unique<Arg>(
280 return SynthesizedArgs.back().get();
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This is an optimization pass for GlobalISel generic memory operations.
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.
A concrete instance of a particular driver option.
LLVM_NODISCARD 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 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 erase(const KeyT &Val)
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...
bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const
hasFlag - Given an option Pos and its negative form Neg, return true if the option is present,...
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const Option & getOption() const
SmallVectorImpl< const char * > & getValues()
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
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.
bool matches(OptSpecifier ID) const
matches - Predicate for whether this option is part of the given option (which may be a group).
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef getLastArgValue(OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.
void eraseArg(OptSpecifier Id)
eraseArg - Remove any option matching Id.
const char * getValue(unsigned N=0) const
OptSpecifier - Wrapper class for abstracting references to option IDs.
void append(Arg *A)
append - Append A to the arg list.
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
StringRef getName() const
Get the name of this option without any prefix.
void ClaimAllArgs() const
ClaimAllArgs - Claim all arguments.
void render(const ArgList &Args, ArgStringList &Output) const
Append the argument onto the given array as strings.
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.
StringRef getPrefix() const
Get the default prefix for this option.
DerivedArgList(const InputArgList &BaseArgs)
Construct a new derived arg list from BaseArgs.
iterator find(const_arg_type_t< KeyT > Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
StringRef - Represent a constant reference to a string, i.e.
void addOptInFlag(ArgStringList &Output, OptSpecifier Pos, OptSpecifier Neg) const
Given an option Pos and its negative form Neg, render the option if Pos is present.
void print(raw_ostream &O) const
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...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
constexpr LLVM_NODISCARD size_t size() const
size - Get the string size.
Option - Abstract representation for a single form of driver argument.
void AddSynthesizedArg(Arg *A)
AddSynthesizedArg - Add a argument to the list of synthesized arguments (to be freed).
void AddAllArgs(ArgStringList &Output, ArrayRef< OptSpecifier > Ids) const
AddAllArgs - Render all arguments matching any of the given ids.
iterator_range< filtered_iterator< sizeof...(OptSpecifiers)> > filtered(OptSpecifiers ...Ids) const
const char * MakeArgString(const Twine &Str) const
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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.
LLVM Value Representation.
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
const char * MakeArgStringRef(StringRef Str) const override
Construct a constant string pointer whose lifetime will match that of the ArgList.
Arg * getLastArg(OptSpecifiers ...Ids) const
Return the last argument matching Id, or null.