Skip to content

Commit 7cc17fb

Browse files
[ADT] Remove old range constructors of SmallSet and StringSet (#133205)
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.
1 parent cde58bf commit 7cc17fb

File tree

4 files changed

+2
-18
lines changed

4 files changed

+2
-18
lines changed

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class PrebuiltModuleListener : public ASTReaderListener {
119119
bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts,
120120
bool Complain) override {
121121
std::vector<std::string> VFSOverlayFiles = HSOpts.VFSOverlayFiles;
122-
PrebuiltModuleVFSMap.insert(
123-
{CurrentFile, llvm::StringSet<>(VFSOverlayFiles)});
122+
PrebuiltModuleVFSMap.try_emplace(CurrentFile, llvm::from_range,
123+
VFSOverlayFiles);
124124
return checkHeaderSearchPaths(
125125
HSOpts, ExistingHSOpts, Complain ? &Diags : nullptr, ExistingLangOpts);
126126
}

llvm/include/llvm/ADT/SmallSet.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ class SmallSet {
161161
SmallSet(llvm::from_range_t, Range &&R)
162162
: SmallSet(adl_begin(R), adl_end(R)) {}
163163

164-
template <typename RangeT>
165-
explicit SmallSet(const iterator_range<RangeT> &R) {
166-
insert(R.begin(), R.end());
167-
}
168-
169164
SmallSet(std::initializer_list<T> L) { insert(L.begin(), L.end()); }
170165

171166
SmallSet &operator=(const SmallSet &) = default;

llvm/include/llvm/ADT/StringSet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class StringSet : public StringMap<std::nullopt_t, AllocatorTy> {
3434
template <typename Range> StringSet(llvm::from_range_t, Range &&R) {
3535
insert(adl_begin(R), adl_end(R));
3636
}
37-
template <typename Container> explicit StringSet(Container &&C) {
38-
for (auto &&Str : C)
39-
insert(Str);
40-
}
4137
explicit StringSet(AllocatorTy a) : Base(a) {}
4238

4339
std::pair<typename Base::iterator, bool> insert(StringRef key) {

llvm/unittests/ADT/SmallSetTest.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ TEST(SmallSetTest, ConstructorIteratorPair) {
2424
EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
2525
}
2626

27-
TEST(SmallSet, ConstructorRange) {
28-
std::initializer_list<int> L = {1, 2, 3, 4, 5};
29-
30-
SmallSet<int, 4> S(llvm::make_range(std::begin(L), std::end(L)));
31-
EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
32-
}
33-
3427
TEST(SmallSet, ConstructorInitializerList) {
3528
std::initializer_list<int> L = {1, 2, 3, 4, 5};
3629
SmallSet<int, 4> S = {1, 2, 3, 4, 5};

0 commit comments

Comments
 (0)