Skip to content

Commit 01bbbb5

Browse files
[ADT] Deprecate the redirection from SmallSet to SmallPtrSet (llvm#154891)
This patch deprecates the redirection from SmallSet to SmallPtrSet. I attempted to deprecate in the usual manner: template <typename PointeeType, unsigned N> LLVM_DEPRECATED("...", "...") class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; However, the deprecation warning wouldn't fire. For this reason, I've attached a deprecation message to the default constructor.
1 parent 9dc66a6 commit 01bbbb5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

llvm/include/llvm/ADT/SmallSet.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,28 @@ class SmallSet {
269269
/// If this set is of pointer values, transparently switch over to using
270270
/// SmallPtrSet for performance.
271271
template <typename PointeeType, unsigned N>
272-
class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
272+
class SmallSet<PointeeType *, N> : public SmallPtrSet<PointeeType *, N> {
273+
using Base = SmallPtrSet<PointeeType *, N>;
274+
275+
public:
276+
// LLVM_DEPRECATED placed between "template" and "class" above won't work for
277+
// some reason. Put a deprecation message on constructors instead.
278+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
279+
SmallSet() = default;
280+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
281+
SmallSet(const SmallSet &) = default;
282+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
283+
SmallSet(SmallSet &&) = default;
284+
template <typename IterT>
285+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
286+
SmallSet(IterT Begin, IterT End) : Base(Begin, End) {}
287+
template <typename Range>
288+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
289+
SmallSet(llvm::from_range_t, Range &&R)
290+
: Base(llvm::from_range, std::move(R)) {}
291+
LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
292+
SmallSet(std::initializer_list<PointeeType *> L) : Base(L) {}
293+
};
273294

274295
/// Equality comparison for SmallSet.
275296
///

0 commit comments

Comments
 (0)