[llvm] af74f06 - ArgList: Simplify 3-opt overload of AddAllArgs. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 01:15:35 PDT 2023


Author: Fangrui Song
Date: 2023-10-12T01:15:28-07:00
New Revision: af74f06322410e867294ea3587e5884342564e5c

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

LOG: ArgList: Simplify 3-opt overload of AddAllArgs. NFC

Added: 
    

Modified: 
    llvm/include/llvm/Option/ArgList.h
    llvm/lib/Option/ArgList.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h
index 79d99a71c2009ca..fcde68e0b7fe8f6 100644
--- a/llvm/include/llvm/Option/ArgList.h
+++ b/llvm/include/llvm/Option/ArgList.h
@@ -333,8 +333,7 @@ class ArgList {
   void addAllArgs(ArgStringList &Output, ArrayRef<OptSpecifier> Ids) const;
 
   /// AddAllArgs - Render all arguments matching the given ids.
-  void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
-                  OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
+  void AddAllArgs(ArgStringList &Output, OptSpecifier Id0) const;
 
   /// AddAllArgValues - Render the argument values of all arguments
   /// matching the given ids.

diff  --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp
index 5b267180d2b37eb..8f764ec779f3fd3 100644
--- a/llvm/lib/Option/ArgList.cpp
+++ b/llvm/lib/Option/ArgList.cpp
@@ -138,11 +138,8 @@ void ArgList::addAllArgs(ArgStringList &Output,
   AddAllArgsExcept(Output, Ids, Exclude);
 }
 
-/// This 3-opt variant of AddAllArgs could be eliminated in favor of one
-/// that accepts a single specifier, given the above which accepts any number.
-void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
-                         OptSpecifier Id1, OptSpecifier Id2) const {
-  for (auto *Arg : filtered(Id0, Id1, Id2)) {
+void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0) const {
+  for (auto *Arg : filtered(Id0)) {
     Arg->claim();
     Arg->render(*this, Output);
   }


        


More information about the llvm-commits mailing list