[PATCH] D96325: [clang][cli] NFC: Remove ArgList infrastructure for recording queries

Jan Svoboda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 02:11:16 PST 2021


jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith.
Herald added a subscriber: hiraditya.
jansvoboda11 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch removes the infrastructure for recording queries in `ArgList`, partially reverting D94472 <https://reviews.llvm.org/D94472>.

The infrastructure was used during command line round-trip to determine which arguments should a certain subset of `CompilerInvocation` generate.

Since D96280 <https://reviews.llvm.org/D96280>, the command line arguments are being generated all at once, making this code no longer necessary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96325

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


Index: llvm/lib/Option/ArgList.cpp
===================================================================
--- llvm/lib/Option/ArgList.cpp
+++ llvm/lib/Option/ArgList.cpp
@@ -90,22 +90,11 @@
 }
 
 std::vector<std::string> ArgList::getAllArgValues(OptSpecifier Id) const {
-  recordQueriedOpts(Id);
   SmallVector<const char *, 16> Values;
   AddAllArgValues(Values, Id);
   return std::vector<std::string>(Values.begin(), Values.end());
 }
 
-void ArgList::AddAllArgsExcept(ArgStringList &Output,
-                               const DenseSet<unsigned> &ExcludeIds) const {
-  for (const Arg *Arg : *this) {
-    if (!ExcludeIds.contains(Arg->getOption().getID())) {
-      Arg->claim();
-      Arg->render(*this, Output);
-    }
-  }
-}
-
 void ArgList::AddAllArgsExcept(ArgStringList &Output,
                                ArrayRef<OptSpecifier> Ids,
                                ArrayRef<OptSpecifier> ExcludeIds) const {
Index: llvm/include/llvm/Option/ArgList.h
===================================================================
--- llvm/include/llvm/Option/ArgList.h
+++ llvm/include/llvm/Option/ArgList.h
@@ -137,16 +137,6 @@
   /// The first and last index of each different OptSpecifier ID.
   DenseMap<unsigned, OptRange> OptRanges;
 
-  /// The OptSpecifiers that were queried from this argument list.
-  mutable DenseSet<unsigned> QueriedOpts;
-
-  /// Record the queried OptSpecifiers.
-  template <typename... OptSpecifiers>
-  void recordQueriedOpts(OptSpecifiers... Ids) const {
-    SmallVector<unsigned, 4> OptsSpecifiers({toOptSpecifier(Ids).getID()...});
-    QueriedOpts.insert(OptsSpecifiers.begin(), OptsSpecifiers.end());
-  }
-
   /// Get the range of indexes in which options with the specified IDs might
   /// reside, or (0, 0) if there are no such options.
   OptRange getRange(std::initializer_list<OptSpecifier> Ids) const;
@@ -213,7 +203,6 @@
   template<typename ...OptSpecifiers>
   iterator_range<filtered_iterator<sizeof...(OptSpecifiers)>>
   filtered(OptSpecifiers ...Ids) const {
-    recordQueriedOpts(Ids...);
     OptRange Range = getRange({toOptSpecifier(Ids)...});
     auto B = Args.begin() + Range.first;
     auto E = Args.begin() + Range.second;
@@ -225,7 +214,6 @@
   template<typename ...OptSpecifiers>
   iterator_range<filtered_reverse_iterator<sizeof...(OptSpecifiers)>>
   filtered_reverse(OptSpecifiers ...Ids) const {
-    recordQueriedOpts(Ids...);
     OptRange Range = getRange({toOptSpecifier(Ids)...});
     auto B = Args.rend() - Range.second;
     auto E = Args.rend() - Range.first;
@@ -320,10 +308,6 @@
       A->render(*this, Output);
   }
 
-  /// AddAllArgsExcept - Render all arguments not matching any of the excluded
-  /// ids.
-  void AddAllArgsExcept(ArgStringList &Output,
-                        const DenseSet<unsigned> &ExcludeIds) const;
   /// AddAllArgsExcept - Render all arguments matching any of the given ids
   /// and not matching any of the excluded ids.
   void AddAllArgsExcept(ArgStringList &Output, ArrayRef<OptSpecifier> Ids,
@@ -357,13 +341,6 @@
   /// ClaimAllArgs - Claim all arguments.
   ///
   void ClaimAllArgs() const;
-
-  /// Return the OptSpecifiers queried from this argument list.
-  const DenseSet<unsigned> &getQueriedOpts() const { return QueriedOpts; }
-
-  /// Clear the set of queried OptSpecifiers.
-  void clearQueriedOpts() const { QueriedOpts.clear(); }
-
   /// @}
   /// @name Arg Synthesis
   /// @{


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96325.322317.patch
Type: text/x-patch
Size: 3423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210209/0662ac52/attachment.bin>


More information about the llvm-commits mailing list