[llvm] 680124c - [Option] Fix param name mismatch & coding style (NFC) (#180746)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 00:01:34 PST 2026


Author: fogsong233
Date: 2026-02-11T15:01:29+07:00
New Revision: 680124ca9a06bd7413cf4cc1dab80f929c7d0bca

URL: https://github.com/llvm/llvm-project/commit/680124ca9a06bd7413cf4cc1dab80f929c7d0bca
DIFF: https://github.com/llvm/llvm-project/commit/680124ca9a06bd7413cf4cc1dab80f929c7d0bca.diff

LOG: [Option] Fix param name mismatch & coding style (NFC) (#180746)

Align parameter names between the declaration and
definition in Option.cpp.
Also, update variable names to adhere to the LLVM
Coding Standards regarding casing.
See
https://github.com/llvm/llvm-project/blob/6c0ff8d12fe5b7d1d55098ca31dac56d8925bf7b/llvm/include/llvm/Option/Option.h#L242.

However the defination is:

https://github.com/llvm/llvm-project/blob/6c0ff8d12fe5b7d1d55098ca31dac56d8925bf7b/llvm/lib/Option/Option.cpp#L112-L114

Added: 
    

Modified: 
    llvm/lib/Option/Option.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Option/Option.cpp b/llvm/lib/Option/Option.cpp
index 738f75bb41e68..838dd344b18a9 100644
--- a/llvm/lib/Option/Option.cpp
+++ b/llvm/lib/Option/Option.cpp
@@ -22,8 +22,8 @@
 using namespace llvm;
 using namespace llvm::opt;
 
-Option::Option(const OptTable::Info *info, const OptTable *owner)
-  : Info(info), Owner(owner) {
+Option::Option(const OptTable::Info *Info, const OptTable *Owner)
+    : Info(Info), Owner(Owner) {
   // Multi-level aliases are not supported. This just simplifies option
   // tracking, it is not an inherent limitation.
   assert((!Info || !getAlias().isValid() || !getAlias().getAlias().isValid()) &&
@@ -110,24 +110,24 @@ bool Option::matches(OptSpecifier Opt) const {
 }
 
 std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
-                                            StringRef Spelling,
+                                            StringRef CurArg,
                                             unsigned &Index) const {
-  const size_t SpellingSize = Spelling.size();
+  const size_t SpellingSize = CurArg.size();
   const size_t ArgStringSize = StringRef(Args.getArgString(Index)).size();
   switch (getKind()) {
   case FlagClass: {
     if (SpellingSize != ArgStringSize)
       return nullptr;
-    return std::make_unique<Arg>(*this, Spelling, Index++);
+    return std::make_unique<Arg>(*this, CurArg, Index++);
   }
   case JoinedClass: {
     const char *Value = Args.getArgString(Index) + SpellingSize;
-    return std::make_unique<Arg>(*this, Spelling, Index++, Value);
+    return std::make_unique<Arg>(*this, CurArg, Index++, Value);
   }
   case CommaJoinedClass: {
     // Always matches.
     const char *Str = Args.getArgString(Index) + SpellingSize;
-    auto A = std::make_unique<Arg>(*this, Spelling, Index++);
+    auto A = std::make_unique<Arg>(*this, CurArg, Index++);
 
     // Parse out the comma separated values.
     const char *Prev = Str;
@@ -162,7 +162,7 @@ std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
         Args.getArgString(Index - 1) == nullptr)
       return nullptr;
 
-    return std::make_unique<Arg>(*this, Spelling, Index - 2,
+    return std::make_unique<Arg>(*this, CurArg, Index - 2,
                                  Args.getArgString(Index - 1));
   case MultiArgClass: {
     // Matches iff this is an exact match.
@@ -173,7 +173,7 @@ std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
     if (Index > Args.getNumInputArgStrings())
       return nullptr;
 
-    auto A = std::make_unique<Arg>(*this, Spelling, Index - 1 - getNumArgs(),
+    auto A = std::make_unique<Arg>(*this, CurArg, Index - 1 - getNumArgs(),
                                    Args.getArgString(Index - getNumArgs()));
     for (unsigned i = 1; i != getNumArgs(); ++i)
       A->getValues().push_back(Args.getArgString(Index - getNumArgs() + i));
@@ -183,7 +183,7 @@ std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
     // If this is not an exact match, it is a joined arg.
     if (SpellingSize != ArgStringSize) {
       const char *Value = Args.getArgString(Index) + SpellingSize;
-      return std::make_unique<Arg>(*this, Spelling, Index++, Value);
+      return std::make_unique<Arg>(*this, CurArg, Index++, Value);
     }
 
     // Otherwise it must be separate.
@@ -192,7 +192,7 @@ std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
         Args.getArgString(Index - 1) == nullptr)
       return nullptr;
 
-    return std::make_unique<Arg>(*this, Spelling, Index - 2,
+    return std::make_unique<Arg>(*this, CurArg, Index - 2,
                                  Args.getArgString(Index - 1));
   }
   case JoinedAndSeparateClass:
@@ -202,21 +202,21 @@ std::unique_ptr<Arg> Option::acceptInternal(const ArgList &Args,
         Args.getArgString(Index - 1) == nullptr)
       return nullptr;
 
-    return std::make_unique<Arg>(*this, Spelling, Index - 2,
+    return std::make_unique<Arg>(*this, CurArg, Index - 2,
                                  Args.getArgString(Index - 2) + SpellingSize,
                                  Args.getArgString(Index - 1));
   case RemainingArgsClass: {
     // Matches iff this is an exact match.
     if (SpellingSize != ArgStringSize)
       return nullptr;
-    auto A = std::make_unique<Arg>(*this, Spelling, Index++);
+    auto A = std::make_unique<Arg>(*this, CurArg, Index++);
     while (Index < Args.getNumInputArgStrings() &&
            Args.getArgString(Index) != nullptr)
       A->getValues().push_back(Args.getArgString(Index++));
     return A;
   }
   case RemainingArgsJoinedClass: {
-    auto A = std::make_unique<Arg>(*this, Spelling, Index);
+    auto A = std::make_unique<Arg>(*this, CurArg, Index);
     if (SpellingSize != ArgStringSize) {
       // An inexact match means there is a joined arg.
       A->getValues().push_back(Args.getArgString(Index) + SpellingSize);


        


More information about the llvm-commits mailing list