[llvm] 43cac1d - [clang][cli] NFC: Remove ArgList infrastructure for recording queries
Jan Svoboda via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 04:53:31 PST 2021
Author: Jan Svoboda
Date: 2021-02-25T13:53:24+01:00
New Revision: 43cac1d27d7d57a7800150f95c3f8ac1e3b2bc2b
URL: https://github.com/llvm/llvm-project/commit/43cac1d27d7d57a7800150f95c3f8ac1e3b2bc2b
DIFF: https://github.com/llvm/llvm-project/commit/43cac1d27d7d57a7800150f95c3f8ac1e3b2bc2b.diff
LOG: [clang][cli] NFC: Remove ArgList infrastructure for recording queries
This patch removes the infrastructure for recording queries in `ArgList`, partially reverting D94472.
The infrastructure was used during command line round-trip to determine which arguments should a certain subset of `CompilerInvocation` generate.
Since D96280, the command line arguments are being generated all at once, making this code no longer necessary.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D96325
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 4ac034635c39..f6abf2a62aa5 100644
--- a/llvm/include/llvm/Option/ArgList.h
+++ b/llvm/include/llvm/Option/ArgList.h
@@ -137,16 +137,6 @@ class ArgList {
/// The first and last index of each
diff erent 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 @@ class ArgList {
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 @@ class ArgList {
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 @@ class ArgList {
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 @@ class ArgList {
/// 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
/// @{
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp
index 2a59bc8460ee..ad7be5fbec19 100644
--- a/llvm/lib/Option/ArgList.cpp
+++ b/llvm/lib/Option/ArgList.cpp
@@ -90,22 +90,11 @@ StringRef ArgList::getLastArgValue(OptSpecifier Id, StringRef Default) const {
}
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 {
More information about the llvm-commits
mailing list