std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
StringRef Spelling,
unsigned &Index) const {
- size_t ArgSize = Spelling.size();
+ const size_t SpellingSize = Spelling.size();
switch (getKind()) {
case FlagClass: {
- if (ArgSize != strlen(Args.getArgString(Index)))
+ if (SpellingSize != strlen(Args.getArgString(Index)))
return nullptr;
return std::make_unique<Arg>(*this, Spelling, Index++);
}
case JoinedClass: {
- const char *Value = Args.getArgString(Index) + ArgSize;
+ const char *Value = Args.getArgString(Index) + SpellingSize;
return std::make_unique<Arg>(*this, Spelling, Index++, Value);
}
case CommaJoinedClass: {
// Always matches.
- const char *Str = Args.getArgString(Index) + ArgSize;
+ const char *Str = Args.getArgString(Index) + SpellingSize;
auto A = std::make_unique<Arg>(*this, Spelling, Index++);
// Parse out the comma separated values.
case SeparateClass:
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
- if (ArgSize != strlen(Args.getArgString(Index)))
+ if (SpellingSize != strlen(Args.getArgString(Index)))
return nullptr;
Index += 2;
case MultiArgClass: {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
- if (ArgSize != strlen(Args.getArgString(Index)))
+ if (SpellingSize != strlen(Args.getArgString(Index)))
return nullptr;
Index += 1 + getNumArgs();
case JoinedOrSeparateClass: {
// If this is not an exact match, it is a joined arg.
// FIXME: Avoid strlen.
- if (ArgSize != strlen(Args.getArgString(Index))) {
- const char *Value = Args.getArgString(Index) + ArgSize;
+ if (SpellingSize != strlen(Args.getArgString(Index))) {
+ const char *Value = Args.getArgString(Index) + SpellingSize;
return std::make_unique<Arg>(*this, Spelling, Index++, Value);
}
return nullptr;
return std::make_unique<Arg>(*this, Spelling, Index - 2,
- Args.getArgString(Index - 2) + ArgSize,
+ Args.getArgString(Index - 2) + SpellingSize,
Args.getArgString(Index - 1));
case RemainingArgsClass: {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
- if (ArgSize != strlen(Args.getArgString(Index)))
+ if (SpellingSize != strlen(Args.getArgString(Index)))
return nullptr;
auto A = std::make_unique<Arg>(*this, Spelling, Index++);
while (Index < Args.getNumInputArgStrings() &&
}
case RemainingArgsJoinedClass: {
auto A = std::make_unique<Arg>(*this, Spelling, Index);
- if (ArgSize != strlen(Args.getArgString(Index))) {
+ if (SpellingSize != strlen(Args.getArgString(Index))) {
// An inexact match means there is a joined arg.
- A->getValues().push_back(Args.getArgString(Index) + ArgSize);
+ A->getValues().push_back(Args.getArgString(Index) + SpellingSize);
}
Index++;
while (Index < Args.getNumInputArgStrings() &&