-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Remove dead implementation of is_nothrow_convertible and merge the remaining code into is_convertible.h #137717
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
Merged
philnik777
merged 1 commit into
llvm:main
from
philnik777:simplify_is_nothrow_convertible
Apr 29, 2025
Merged
[libc++] Remove dead implementation of is_nothrow_convertible and merge the remaining code into is_convertible.h #137717
philnik777
merged 1 commit into
llvm:main
from
philnik777:simplify_is_nothrow_convertible
Apr 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ge the remaining code into is_convertible.h
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesWe can use the Full diff: https://github.com/llvm/llvm-project/pull/137717.diff 5 Files Affected:
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index f1bdf684a8549..0277382cc84dd 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -835,7 +835,6 @@ set(files
__type_traits/is_member_pointer.h
__type_traits/is_nothrow_assignable.h
__type_traits/is_nothrow_constructible.h
- __type_traits/is_nothrow_convertible.h
__type_traits/is_nothrow_destructible.h
__type_traits/is_null_pointer.h
__type_traits/is_object.h
diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h
index cef3c4a764914..f0a859f9cc16d 100644
--- a/libcxx/include/__type_traits/is_convertible.h
+++ b/libcxx/include/__type_traits/is_convertible.h
@@ -26,6 +26,16 @@ template <class _From, class _To>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
#endif
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Tp, class _Up>
+struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
+
+template <class _Tp, class _Up>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);
+
+#endif // _LIBCPP_STD_VER >= 20
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H
diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h
deleted file mode 100644
index f114619296437..0000000000000
--- a/libcxx/include/__type_traits/is_nothrow_convertible.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
-#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
-
-#include <__config>
-#include <__type_traits/conjunction.h>
-#include <__type_traits/disjunction.h>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/is_convertible.h>
-#include <__type_traits/is_void.h>
-#include <__type_traits/lazy.h>
-#include <__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-# if __has_builtin(__is_nothrow_convertible)
-
-template <class _Tp, class _Up>
-struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
-
-template <class _Tp, class _Up>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);
-
-# else // __has_builtin(__is_nothrow_convertible)
-
-template <typename _Tp>
-void __test_noexcept(_Tp) noexcept;
-
-template <typename _Fm, typename _To>
-bool_constant<noexcept(std::__test_noexcept<_To>(std::declval<_Fm>()))> __is_nothrow_convertible_test();
-
-template <typename _Fm, typename _To>
-struct __is_nothrow_convertible_helper : decltype(std::__is_nothrow_convertible_test<_Fm, _To>()) {};
-
-template <typename _Fm, typename _To>
-struct is_nothrow_convertible
- : _Or<_And<is_void<_To>, is_void<_Fm>>,
- _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To> > >::type {};
-
-template <typename _Fm, typename _To>
-inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
-
-# endif // __has_builtin(__is_nothrow_convertible)
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index af928a63f2315..7260c3a5d51f3 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -232,10 +232,6 @@ module std_core [system] {
header "__type_traits/is_nothrow_constructible.h"
export std_core.type_traits.integral_constant
}
- module is_nothrow_convertible {
- header "__type_traits/is_nothrow_convertible.h"
- export std_core.type_traits.integral_constant
- }
module is_nothrow_destructible {
header "__type_traits/is_nothrow_destructible.h"
export std_core.type_traits.integral_constant
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index b63f61cfefe8e..9db7b2afb0cf3 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -549,7 +549,6 @@ namespace std
# include <__type_traits/common_reference.h>
# include <__type_traits/is_bounded_array.h>
# include <__type_traits/is_constant_evaluated.h>
-# include <__type_traits/is_nothrow_convertible.h>
# include <__type_traits/is_unbounded_array.h>
# include <__type_traits/type_identity.h>
# include <__type_traits/unwrap_ref.h>
|
gizmondo
pushed a commit
to gizmondo/llvm-project
that referenced
this pull request
Apr 29, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Apr 30, 2025
This patch removes the is_nothrow_convertible.h file from the list of available headers, to match the changes in llvm/llvm-project#137717 Bug: 40263312 Change-Id: I02fcaef097d83c0674c6c3b573b2e199e4f76305 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6500519 Commit-Queue: Takuto Ikuta <[email protected]> Commit-Queue: Hans Wennborg <[email protected]> Reviewed-by: Hans Wennborg <[email protected]> Auto-Submit: Takuto Ikuta <[email protected]> Cr-Commit-Position: refs/heads/main@{#1453797}
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
GeorgeARM
pushed a commit
to GeorgeARM/llvm-project
that referenced
this pull request
May 7, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
Ankur-0429
pushed a commit
to Ankur-0429/llvm-project
that referenced
this pull request
May 9, 2025
…ge the remaining code into is_convertible.h (llvm#137717) We can use the `__is_nothrow_convertible` builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We can use the
__is_nothrow_convertible
builtin unconditionally now, which makes the implementation very simple, so there isn't much of a need to keep a separate header around.