-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[ADT] Deprecate the redirection from SmallSet to SmallPtrSet (Take 2) #155078
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] Deprecate the redirection from SmallSet to SmallPtrSet (Take 2) #155078
Conversation
This patch deprecates the SmallSet specialization for pointer types, which redirects to SmallPtrSet. My previous attempt in llvm#154891 broke downstream users. Adding user-defined constructors with LLVM_DEPRECATED inadvertently caused the compiler to delete the copy and move assignment operators. This iteration sidesteps the "Rule of Five" issue entirely by introducing an intermediate class, DeprecatedSmallSet. The deprecation attribute is attached to this new class, and SmallSet specialization inherits from it.
@llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesThis patch deprecates the SmallSet specialization for pointer types, My previous attempt in #154891 broke downstream users. Adding This iteration sidesteps the "Rule of Five" issue entirely by Full diff: https://github.com/llvm/llvm-project/pull/155078.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h
index eb434bcb71717..96a68fb8da0e2 100644
--- a/llvm/include/llvm/ADT/SmallSet.h
+++ b/llvm/include/llvm/ADT/SmallSet.h
@@ -268,8 +268,17 @@ class SmallSet {
/// If this set is of pointer values, transparently switch over to using
/// SmallPtrSet for performance.
+///
+/// We use this middleman class DeprecatedSmallSet so that the deprecation
+/// warning works. Placing LLVM_DEPRECATED just before SmallSet below won't
+/// work.
+template <typename PointeeType, unsigned N>
+class LLVM_DEPRECATED("Use SmallPtrSet instead", "SmallPtrSet")
+ DeprecatedSmallSet : public SmallPtrSet<PointeeType *, N> {};
+
template <typename PointeeType, unsigned N>
-class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {};
+class SmallSet<PointeeType *, N> : public DeprecatedSmallSet<PointeeType *, N> {
+};
/// Equality comparison for SmallSet.
///
|
This code is turning |
Can you fix forward? This should be simple from the sounds of it. |
For posterity: #155117 |
Note, this is also still in the docs: https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallset-h |
after this PR, i am seeing ~1800+ messages of the form was this expected ? |
In llvm and its subprojects, or in a downstream project? |
llvm.org main branch, lots of projects . i am building with these enabled |
Any downstream files trying to use headers that has #include <SmallSet.h> will get warnings, there is no use of SmallSet at all.
|
I'm seeing gcc warn unconditionally (godbolt link) but clang only warn if the template is used. Maybe this should be reverted? |
…(Take 2) (llvm#155078)" This reverts commit 9b493dc. There are hundreds of warnings when building LLVM/Clang because of this right now. See the original PR for the detailed issues. Also revert the follow-up fix "[ADT] Fix redirection of SmallSet to SmallPtrSet (llvm#155117)" This reverts commit 3ca1ca4.
Reverting in #155622 |
…(Take 2) (llvm#155078)" This reverts commit 9b493dc. There are hundreds of warnings when building LLVM/Clang because of this right now. See the original PR for the detailed issues. Also revert the follow-up fix "[ADT] Fix redirection of SmallSet to SmallPtrSet (llvm#155117)" This reverts commit 3ca1ca4.
…(Take 2) (#155078) (#155622) This reverts commit 9b493dc. There are hundreds of warnings when building LLVM/Clang because of this right now. See the original PR for the detailed issues. Also revert the follow-up fix "[ADT] Fix redirection of SmallSet to SmallPtrSet (#155117)" This reverts commit 3ca1ca4.
This patch deprecates the SmallSet specialization for pointer types,
which redirects to SmallPtrSet.
My previous attempt in #154891 broke downstream users. Adding
user-defined constructors with LLVM_DEPRECATED inadvertently caused
the compiler to delete the copy and move assignment operators.
This iteration sidesteps the "Rule of Five" issue entirely by
introducing an intermediate class, DeprecatedSmallSet. The
deprecation attribute is attached to this new class, and SmallSet
specialization inherits from it.