11#include "llvm/Config/llvm-config.h"
31 "Multi-level aliases are not supported.");
37 "Cannot provide alias args to a flag option.");
44#define P(N) case N: O << #N; break
68 O <<
" Name:\"" <<
getName() <<
'"';
88#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
108std::unique_ptr<Arg> Option::acceptInternal(
const ArgList &Args,
110 unsigned &
Index)
const {
111 const size_t SpellingSize = Spelling.
size();
115 if (SpellingSize != ArgStringSize)
117 return std::make_unique<Arg>(*
this, Spelling,
Index++);
120 const char *
Value = Args.getArgString(
Index) + SpellingSize;
121 return std::make_unique<Arg>(*
this, Spelling,
Index++,
Value);
125 const char *Str = Args.getArgString(
Index) + SpellingSize;
126 auto A = std::make_unique<Arg>(*
this, Spelling,
Index++);
129 const char *Prev = Str;
133 if (!c || c ==
',') {
135 char *
Value =
new char[Str - Prev + 1];
136 memcpy(
Value, Prev, Str - Prev);
137 Value[Str - Prev] =
'\0';
138 A->getValues().push_back(
Value);
147 A->setOwnsValues(
true);
153 if (SpellingSize != ArgStringSize)
157 if (
Index >
Args.getNumInputArgStrings() ||
161 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
165 if (SpellingSize != ArgStringSize)
169 if (
Index >
Args.getNumInputArgStrings())
180 if (SpellingSize != ArgStringSize) {
182 return std::make_unique<Arg>(*
this, Spelling,
Index++,
Value);
187 if (
Index >
Args.getNumInputArgStrings() ||
191 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
197 if (
Index >
Args.getNumInputArgStrings() ||
201 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
202 Args.getArgString(
Index - 2) + SpellingSize,
206 if (SpellingSize != ArgStringSize)
208 auto A = std::make_unique<Arg>(*
this, Spelling,
Index++);
209 while (
Index <
Args.getNumInputArgStrings() &&
211 A->getValues().push_back(
Args.getArgString(
Index++));
215 auto A = std::make_unique<Arg>(*
this, Spelling,
Index);
216 if (SpellingSize != ArgStringSize) {
218 A->getValues().push_back(
Args.getArgString(
Index) + SpellingSize);
221 while (
Index <
Args.getNumInputArgStrings() &&
223 A->getValues().push_back(
Args.getArgString(
Index++));
233 bool GroupedShortOption,
234 unsigned &
Index)
const {
236 ? std::make_unique<Arg>(*
this, CurArg,
Index)
237 : acceptInternal(Args, CurArg,
Index));
254 StringRef UnaliasedSpelling = Args.MakeArgString(
263 std::make_unique<Arg>(UnaliasedOption, UnaliasedSpelling,
A->getIndex());
265 UnaliasedA->setAlias(std::move(
A));
273 UnaliasedA->getValues() = RawA->
getValues();
281 while (*Val !=
'\0') {
282 UnaliasedA->getValues().push_back(Val);
285 Val += strlen(Val) + 1;
290 UnaliasedA->getValues().push_back(
"");
Defines the llvm::Arg class for parsed arguments.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Analysis containing CSE Info
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
ArgList - Ordered collection of driver arguments.
A concrete instance of a particular driver option.
bool getOwnsValues() const
SmallVectorImpl< const char * > & getValues()
void setOwnsValues(bool Value) const
OptSpecifier - Wrapper class for abstracting references to option IDs.
Provide access to the Option info table.
Option - Abstract representation for a single form of driver argument.
const Option getAlias() const
unsigned getNumArgs() const
const char * getAliasArgs() const
Get the alias arguments as a \0 separated list.
const Option getGroup() const
const Option getUnaliasedOption() const
getUnaliasedOption - Return the final option this option aliases (itself, if the option has no alias)...
bool matches(OptSpecifier ID) const
matches - Predicate for whether this option is part of the given option (which may be a group).
Option(const OptTable::Info *Info, const OptTable *Owner)
void print(raw_ostream &O) const
@ RemainingArgsJoinedClass
StringRef getPrefix() const
Get the default prefix for this option.
const OptTable::Info * Info
StringRef getName() const
Get the name of this option without any prefix.
std::unique_ptr< Arg > accept(const ArgList &Args, StringRef CurArg, bool GroupedShortOption, unsigned &Index) const
Potentially accept the current argument, returning a new Arg instance, or 0 if the option does not ac...
OptionClass getKind() const
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Entry for a single option instance in the option data table.
ArrayRef< StringLiteral > Prefixes
A null terminated array of prefix strings to apply to name while matching.