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() <<
'"';
73 Group.
print(O,
false);
79 Alias.
print(O,
false);
90#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
110std::unique_ptr<Arg> Option::acceptInternal(
const ArgList &Args,
112 unsigned &
Index)
const {
113 const size_t SpellingSize = Spelling.
size();
117 if (SpellingSize != ArgStringSize)
119 return std::make_unique<Arg>(*
this, Spelling,
Index++);
122 const char *
Value = Args.getArgString(
Index) + SpellingSize;
123 return std::make_unique<Arg>(*
this, Spelling,
Index++,
Value);
127 const char *Str = Args.getArgString(
Index) + SpellingSize;
128 auto A = std::make_unique<Arg>(*
this, Spelling,
Index++);
131 const char *Prev = Str;
135 if (!c || c ==
',') {
137 char *
Value =
new char[Str - Prev + 1];
138 memcpy(
Value, Prev, Str - Prev);
139 Value[Str - Prev] =
'\0';
140 A->getValues().push_back(
Value);
149 A->setOwnsValues(
true);
155 if (SpellingSize != ArgStringSize)
159 if (
Index >
Args.getNumInputArgStrings() ||
163 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
167 if (SpellingSize != ArgStringSize)
171 if (
Index >
Args.getNumInputArgStrings())
182 if (SpellingSize != ArgStringSize) {
184 return std::make_unique<Arg>(*
this, Spelling,
Index++,
Value);
189 if (
Index >
Args.getNumInputArgStrings() ||
193 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
199 if (
Index >
Args.getNumInputArgStrings() ||
203 return std::make_unique<Arg>(*
this, Spelling,
Index - 2,
204 Args.getArgString(
Index - 2) + SpellingSize,
208 if (SpellingSize != ArgStringSize)
210 auto A = std::make_unique<Arg>(*
this, Spelling,
Index++);
211 while (
Index <
Args.getNumInputArgStrings() &&
213 A->getValues().push_back(
Args.getArgString(
Index++));
217 auto A = std::make_unique<Arg>(*
this, Spelling,
Index);
218 if (SpellingSize != ArgStringSize) {
220 A->getValues().push_back(
Args.getArgString(
Index) + SpellingSize);
223 while (
Index <
Args.getNumInputArgStrings() &&
225 A->getValues().push_back(
Args.getArgString(
Index++));
235 bool GroupedShortOption,
236 unsigned &
Index)
const {
238 ? std::make_unique<Arg>(*
this, CurArg,
Index)
239 : acceptInternal(Args, CurArg,
Index));
256 StringRef UnaliasedSpelling = Args.MakeArgString(
265 std::make_unique<Arg>(UnaliasedOption, UnaliasedSpelling,
A->getIndex());
267 UnaliasedA->setAlias(std::move(
A));
275 UnaliasedA->getValues() = RawA->
getValues();
283 while (*Val !=
'\0') {
284 UnaliasedA->getValues().push_back(Val);
287 Val += strlen(Val) + 1;
292 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)
@ 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
void print(raw_ostream &O, bool AddNewLine=true) 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.