Skip to content

Conversation

rupprecht
Copy link
Collaborator

Reverts #154891

The added constructors changes the semantics of other implicitly defined constructors, which causes downstream breakages.

... error: object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted
... note: explicitly defaulted function was implicitly deleted here
... note: copy assignment operator of 'X' is implicitly deleted because field 'x' has a deleted copy assignment operator
llvm/include/llvm/ADT/SmallSet.h:283:3: note: copy assignment operator is implicitly deleted because 'SmallSet<const XX *, 2>' has a user-declared move constructor
  283 |   SmallSet(SmallSet &&) = default;

@llvmbot
Copy link
Member

llvmbot commented Aug 23, 2025

@llvm/pr-subscribers-llvm-adt

Author: Jordan Rupprecht (rupprecht)

Changes

Reverts llvm/llvm-project#154891

The added constructors changes the semantics of other implicitly defined constructors, which causes downstream breakages.

... error: object of type 'X' cannot be assigned because its copy assignment operator is implicitly deleted
... note: explicitly defaulted function was implicitly deleted here
... note: copy assignment operator of 'X' is implicitly deleted because field 'x' has a deleted copy assignment operator
llvm/include/llvm/ADT/SmallSet.h:283:3: note: copy assignment operator is implicitly deleted because 'SmallSet&lt;const XX *, 2&gt;' has a user-declared move constructor
  283 |   SmallSet(SmallSet &amp;&amp;) = default;

Full diff: https://github.com/llvm/llvm-project/pull/155075.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/SmallSet.h (+1-22)
diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h
index 802a257aaf6ad..eb434bcb71717 100644
--- a/llvm/include/llvm/ADT/SmallSet.h
+++ b/llvm/include/llvm/ADT/SmallSet.h
@@ -269,28 +269,7 @@ class SmallSet {
 /// If this set is of pointer values, transparently switch over to using
 /// SmallPtrSet for performance.
 template <typename PointeeType, unsigned N>
-class SmallSet<PointeeType *, N> : public SmallPtrSet<PointeeType *, N> {
-  using Base = SmallPtrSet<PointeeType *, N>;
-
-public:
-  // LLVM_DEPRECATED placed between "template" and "class" above won't work for
-  // some reason.  Put a deprecation message on constructors instead.
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet() = default;
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet(const SmallSet &) = default;
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet(SmallSet &&) = default;
-  template <typename IterT>
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet(IterT Begin, IterT End) : Base(Begin, End) {}
-  template <typename Range>
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet(llvm::from_range_t, Range &&R)
-      : Base(llvm::from_range, std::move(R)) {}
-  LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
-  SmallSet(std::initializer_list<PointeeType *> L) : Base(L) {}
-};
+class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
 
 /// Equality comparison for SmallSet.
 ///

Copy link
Contributor

@kazutakahirata kazutakahirata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for taking care of this!

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions h -- llvm/include/llvm/ADT/SmallSet.h
View the diff from clang-format here.
diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h
index eb434bcb7..7d8c32875 100644
--- a/llvm/include/llvm/ADT/SmallSet.h
+++ b/llvm/include/llvm/ADT/SmallSet.h
@@ -269,7 +269,7 @@ private:
 /// If this set is of pointer values, transparently switch over to using
 /// SmallPtrSet for performance.
 template <typename PointeeType, unsigned N>
-class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
+class SmallSet<PointeeType *, N> : public SmallPtrSet<PointeeType *, N> {};
 
 /// Equality comparison for SmallSet.
 ///

@rupprecht rupprecht enabled auto-merge (squash) August 23, 2025 04:49
@rupprecht rupprecht merged commit 16deba3 into main Aug 23, 2025
10 of 11 checks passed
@rupprecht rupprecht deleted the revert-154891-cleanup_20250821_deprecate_SmallSet_ptr branch August 23, 2025 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants