-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][ranges] remove __workaround_52970
#85683
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
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-libcxx Author: Xiaoyang Liu (xiaoyang-sde) ChangesAbstractThis pull request removes the Reference
Full diff: https://github.com/llvm/llvm-project/pull/85683.diff 7 Files Affected:
diff --git a/libcxx/include/__concepts/class_or_enum.h b/libcxx/include/__concepts/class_or_enum.h
index c1b4a8c258f3a5..2739e31e14ba65 100644
--- a/libcxx/include/__concepts/class_or_enum.h
+++ b/libcxx/include/__concepts/class_or_enum.h
@@ -28,11 +28,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
-// Work around Clang bug https://llvm.org/PR52970
-// TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14).
-template <class _Tp>
-concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>;
-
#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index 218b3928ecdc5f..3db4f11b40f2d0 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -41,7 +41,7 @@ concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remov
namespace ranges {
namespace __begin {
template <class _Tp>
-concept __member_begin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_begin = __can_borrow<_Tp> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
};
@@ -103,7 +103,7 @@ using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
namespace ranges {
namespace __end {
template <class _Tp>
-concept __member_end = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_end = __can_borrow<_Tp> && requires(_Tp&& __t) {
typename iterator_t<_Tp>;
{ _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
};
diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h
index 18002bb52cc8ce..131f6cdad8f21c 100644
--- a/libcxx/include/__ranges/data.h
+++ b/libcxx/include/__ranges/data.h
@@ -40,7 +40,7 @@ template <class _Tp>
concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
template <class _Tp>
-concept __member_data = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_data = __can_borrow<_Tp> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
};
diff --git a/libcxx/include/__ranges/empty.h b/libcxx/include/__ranges/empty.h
index acd55dae224ce7..5c1004042aba51 100644
--- a/libcxx/include/__ranges/empty.h
+++ b/libcxx/include/__ranges/empty.h
@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __empty {
template <class _Tp>
-concept __member_empty = __workaround_52970<_Tp> && requires(_Tp&& __t) { bool(__t.empty()); };
+concept __member_empty = requires(_Tp&& __t) { bool(__t.empty()); };
template <class _Tp>
concept __can_invoke_size = !__member_empty<_Tp> && requires(_Tp&& __t) { ranges::size(__t); };
diff --git a/libcxx/include/__ranges/rbegin.h b/libcxx/include/__ranges/rbegin.h
index 947e428f00cd52..12e739e1a2b852 100644
--- a/libcxx/include/__ranges/rbegin.h
+++ b/libcxx/include/__ranges/rbegin.h
@@ -36,7 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rbegin {
template <class _Tp>
-concept __member_rbegin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_rbegin = __can_borrow<_Tp> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
};
diff --git a/libcxx/include/__ranges/rend.h b/libcxx/include/__ranges/rend.h
index 1b6be58fea24b4..5edbc4e3160c5f 100644
--- a/libcxx/include/__ranges/rend.h
+++ b/libcxx/include/__ranges/rend.h
@@ -37,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rend {
template <class _Tp>
-concept __member_rend = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_rend = __can_borrow<_Tp> && requires(_Tp&& __t) {
ranges::rbegin(__t);
{ _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
};
diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h
index 59ca2b11ee3890..40b0c6b6aad7a3 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -47,7 +47,7 @@ template <class _Tp>
concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
template <class _Tp>
-concept __member_size = __size_enabled<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+concept __member_size = __size_enabled<_Tp> && requires(_Tp&& __t) {
{ _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
};
|
__workaround_52970
__workaround_52970
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This LGTM with green CI.
Thanks for approving this PR! Could you please merge it once all CI checks have been passed? I don't have the permission to do so. (This also applies to #85004) |
@xiaoyang-sde Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
## Abstract This pull request removes the `__workaround_52970` concept. This concept is a workaround for a bug described in llvm#52970, which causes the compiler to trigger ADL on a pointer to an incomplete type in an SFINAE context. This bug is fixed in Clang 14. ## Reference - [[clang] Don't typo-fix an expression in a SFINAE context](https://reviews.llvm.org/D117603) - [[libc++] [ranges] ADL-proof the [range.access] CPOs.](https://reviews.llvm.org/D116239)
…cbbde5500 Local branch amd-gfx b31cbbd Merged main:d7e28cd82bd3141093f96f7ce2e7b36f1b115fad into amd-gfx:0b79b4caf568 Remote branch main 211eebf [libc++][ranges] remove `__workaround_52970` (llvm#85683)
Abstract
This pull request removes the
__workaround_52970
concept. This concept is a workaround for a bug described in #52970, which causes the compiler to trigger ADL on a pointer to an incomplete type in an SFINAE context. This bug is fixed in Clang 14.Reference