From d3d6a5ff184d4d9c7ac7bcd281281a3b53ed058b Mon Sep 17 00:00:00 2001 From: Ilyas Mustafazade Date: Mon, 20 Mar 2023 13:58:26 -0700 Subject: [PATCH] [NFC] Rename ArgSize to SpellingSize, and add ArgStringSize. Differential Revision: https://reviews.llvm.org/D146394 --- llvm/lib/Option/Option.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Option/Option.cpp b/llvm/lib/Option/Option.cpp index 1f1eb93..95edf32 100644 --- a/llvm/lib/Option/Option.cpp +++ b/llvm/lib/Option/Option.cpp @@ -108,20 +108,20 @@ bool Option::matches(OptSpecifier Opt) const { std::unique_ptr 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(*this, Spelling, Index++); } case JoinedClass: { - const char *Value = Args.getArgString(Index) + ArgSize; + const char *Value = Args.getArgString(Index) + SpellingSize; return std::make_unique(*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(*this, Spelling, Index++); // Parse out the comma separated values. @@ -150,7 +150,7 @@ std::unique_ptr Option::acceptInternal(const ArgList &Args, 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; @@ -163,7 +163,7 @@ std::unique_ptr Option::acceptInternal(const ArgList &Args, 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(); @@ -179,8 +179,8 @@ std::unique_ptr Option::acceptInternal(const ArgList &Args, 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(*this, Spelling, Index++, Value); } @@ -201,12 +201,12 @@ std::unique_ptr Option::acceptInternal(const ArgList &Args, return nullptr; return std::make_unique(*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(*this, Spelling, Index++); while (Index < Args.getNumInputArgStrings() && @@ -216,9 +216,9 @@ std::unique_ptr Option::acceptInternal(const ArgList &Args, } case RemainingArgsJoinedClass: { auto A = std::make_unique(*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() && -- 2.7.4