-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ADT] Remove old range constructors of SmallSet and StringSet #133205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADT] Remove old range constructors of SmallSet and StringSet #133205
Conversation
This patch removes the old range constructors of SmallSet and StringSet that do not take the llvm::from_range tag. Since there are so few uses, this patch directly removes them without going through the deprecation process.
@llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesThis patch removes the old range constructors of SmallSet and Full diff: https://github.com/llvm/llvm-project/pull/133205.diff 4 Files Affected:
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index ca15a088c308d..b7d44caca4954 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -119,8 +119,8 @@ class PrebuiltModuleListener : public ASTReaderListener {
bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts,
bool Complain) override {
std::vector<std::string> VFSOverlayFiles = HSOpts.VFSOverlayFiles;
- PrebuiltModuleVFSMap.insert(
- {CurrentFile, llvm::StringSet<>(VFSOverlayFiles)});
+ PrebuiltModuleVFSMap.try_emplace(CurrentFile, llvm::from_range,
+ VFSOverlayFiles);
return checkHeaderSearchPaths(
HSOpts, ExistingHSOpts, Complain ? &Diags : nullptr, ExistingLangOpts);
}
diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h
index d5702c64efb41..eb434bcb71717 100644
--- a/llvm/include/llvm/ADT/SmallSet.h
+++ b/llvm/include/llvm/ADT/SmallSet.h
@@ -161,11 +161,6 @@ class SmallSet {
SmallSet(llvm::from_range_t, Range &&R)
: SmallSet(adl_begin(R), adl_end(R)) {}
- template <typename RangeT>
- explicit SmallSet(const iterator_range<RangeT> &R) {
- insert(R.begin(), R.end());
- }
-
SmallSet(std::initializer_list<T> L) { insert(L.begin(), L.end()); }
SmallSet &operator=(const SmallSet &) = default;
diff --git a/llvm/include/llvm/ADT/StringSet.h b/llvm/include/llvm/ADT/StringSet.h
index be3cbc676d641..13d2c406c4ff2 100644
--- a/llvm/include/llvm/ADT/StringSet.h
+++ b/llvm/include/llvm/ADT/StringSet.h
@@ -34,10 +34,6 @@ class StringSet : public StringMap<std::nullopt_t, AllocatorTy> {
template <typename Range> StringSet(llvm::from_range_t, Range &&R) {
insert(adl_begin(R), adl_end(R));
}
- template <typename Container> explicit StringSet(Container &&C) {
- for (auto &&Str : C)
- insert(Str);
- }
explicit StringSet(AllocatorTy a) : Base(a) {}
std::pair<typename Base::iterator, bool> insert(StringRef key) {
diff --git a/llvm/unittests/ADT/SmallSetTest.cpp b/llvm/unittests/ADT/SmallSetTest.cpp
index 9e410c6ee2b23..1d1e84ba7fcfd 100644
--- a/llvm/unittests/ADT/SmallSetTest.cpp
+++ b/llvm/unittests/ADT/SmallSetTest.cpp
@@ -24,13 +24,6 @@ TEST(SmallSetTest, ConstructorIteratorPair) {
EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
}
-TEST(SmallSet, ConstructorRange) {
- std::initializer_list<int> L = {1, 2, 3, 4, 5};
-
- SmallSet<int, 4> S(llvm::make_range(std::begin(L), std::end(L)));
- EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
-}
-
TEST(SmallSet, ConstructorInitializerList) {
std::initializer_list<int> L = {1, 2, 3, 4, 5};
SmallSet<int, 4> S = {1, 2, 3, 4, 5};
|
@llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesThis patch removes the old range constructors of SmallSet and Full diff: https://github.com/llvm/llvm-project/pull/133205.diff 4 Files Affected:
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index ca15a088c308d..b7d44caca4954 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -119,8 +119,8 @@ class PrebuiltModuleListener : public ASTReaderListener {
bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts,
bool Complain) override {
std::vector<std::string> VFSOverlayFiles = HSOpts.VFSOverlayFiles;
- PrebuiltModuleVFSMap.insert(
- {CurrentFile, llvm::StringSet<>(VFSOverlayFiles)});
+ PrebuiltModuleVFSMap.try_emplace(CurrentFile, llvm::from_range,
+ VFSOverlayFiles);
return checkHeaderSearchPaths(
HSOpts, ExistingHSOpts, Complain ? &Diags : nullptr, ExistingLangOpts);
}
diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h
index d5702c64efb41..eb434bcb71717 100644
--- a/llvm/include/llvm/ADT/SmallSet.h
+++ b/llvm/include/llvm/ADT/SmallSet.h
@@ -161,11 +161,6 @@ class SmallSet {
SmallSet(llvm::from_range_t, Range &&R)
: SmallSet(adl_begin(R), adl_end(R)) {}
- template <typename RangeT>
- explicit SmallSet(const iterator_range<RangeT> &R) {
- insert(R.begin(), R.end());
- }
-
SmallSet(std::initializer_list<T> L) { insert(L.begin(), L.end()); }
SmallSet &operator=(const SmallSet &) = default;
diff --git a/llvm/include/llvm/ADT/StringSet.h b/llvm/include/llvm/ADT/StringSet.h
index be3cbc676d641..13d2c406c4ff2 100644
--- a/llvm/include/llvm/ADT/StringSet.h
+++ b/llvm/include/llvm/ADT/StringSet.h
@@ -34,10 +34,6 @@ class StringSet : public StringMap<std::nullopt_t, AllocatorTy> {
template <typename Range> StringSet(llvm::from_range_t, Range &&R) {
insert(adl_begin(R), adl_end(R));
}
- template <typename Container> explicit StringSet(Container &&C) {
- for (auto &&Str : C)
- insert(Str);
- }
explicit StringSet(AllocatorTy a) : Base(a) {}
std::pair<typename Base::iterator, bool> insert(StringRef key) {
diff --git a/llvm/unittests/ADT/SmallSetTest.cpp b/llvm/unittests/ADT/SmallSetTest.cpp
index 9e410c6ee2b23..1d1e84ba7fcfd 100644
--- a/llvm/unittests/ADT/SmallSetTest.cpp
+++ b/llvm/unittests/ADT/SmallSetTest.cpp
@@ -24,13 +24,6 @@ TEST(SmallSetTest, ConstructorIteratorPair) {
EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
}
-TEST(SmallSet, ConstructorRange) {
- std::initializer_list<int> L = {1, 2, 3, 4, 5};
-
- SmallSet<int, 4> S(llvm::make_range(std::begin(L), std::end(L)));
- EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
-}
-
TEST(SmallSet, ConstructorInitializerList) {
std::initializer_list<int> L = {1, 2, 3, 4, 5};
SmallSet<int, 4> S = {1, 2, 3, 4, 5};
|
This patch removes the old range constructors of SmallSet and
StringSet that do not take the llvm::from_range tag. Since there are
so few uses, this patch directly removes them without going through
the deprecation process.