Skip to content

Commit c8d406c

Browse files
committed
Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible
Differential Revision: https://reviews.llvm.org/D92543
1 parent a333071 commit c8d406c

File tree

6 files changed

+5
-141
lines changed

6 files changed

+5
-141
lines changed

llvm/include/llvm/ADT/FunctionExtras.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace detail {
5757

5858
template <typename T>
5959
using EnableIfTrivial =
60-
std::enable_if_t<llvm::is_trivially_move_constructible<T>::value &&
60+
std::enable_if_t<std::is_trivially_move_constructible<T>::value &&
6161
std::is_trivially_destructible<T>::value>;
6262

6363
template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
@@ -83,8 +83,8 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
8383
template <typename T>
8484
using AdjustedParamT = typename std::conditional<
8585
!std::is_reference<T>::value &&
86-
llvm::is_trivially_copy_constructible<T>::value &&
87-
llvm::is_trivially_move_constructible<T>::value &&
86+
std::is_trivially_copy_constructible<T>::value &&
87+
std::is_trivially_move_constructible<T>::value &&
8888
IsSizeLessThanThresholdT<T>::value,
8989
T, T &>::type;
9090

llvm/include/llvm/ADT/SmallVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ class SmallVectorTemplateCommon
278278
/// copy these types with memcpy, there is no way for the type to observe this.
279279
/// This catches the important case of std::pair<POD, POD>, which is not
280280
/// trivially assignable.
281-
template <typename T, bool = (is_trivially_copy_constructible<T>::value) &&
282-
(is_trivially_move_constructible<T>::value) &&
281+
template <typename T, bool = (std::is_trivially_copy_constructible<T>::value) &&
282+
(std::is_trivially_move_constructible<T>::value) &&
283283
std::is_trivially_destructible<T>::value>
284284
class SmallVectorTemplateBase : public SmallVectorTemplateCommon<T> {
285285
protected:

llvm/include/llvm/Support/type_traits.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,6 @@ struct const_pointer_or_const_ref<T,
7070
};
7171

7272
namespace detail {
73-
/// Internal utility to detect trivial copy construction.
74-
template<typename T> union copy_construction_triviality_helper {
75-
T t;
76-
copy_construction_triviality_helper() = default;
77-
copy_construction_triviality_helper(const copy_construction_triviality_helper&) = default;
78-
~copy_construction_triviality_helper() = default;
79-
};
80-
/// Internal utility to detect trivial move construction.
81-
template<typename T> union move_construction_triviality_helper {
82-
T t;
83-
move_construction_triviality_helper() = default;
84-
move_construction_triviality_helper(move_construction_triviality_helper&&) = default;
85-
~move_construction_triviality_helper() = default;
86-
};
8773

8874
template<class T>
8975
union trivial_helper {
@@ -92,29 +78,6 @@ union trivial_helper {
9278

9379
} // end namespace detail
9480

95-
/// An implementation of `std::is_trivially_copy_constructible` since we have
96-
/// users with STLs that don't yet include it.
97-
template <typename T>
98-
struct is_trivially_copy_constructible
99-
: std::is_copy_constructible<
100-
::llvm::detail::copy_construction_triviality_helper<T>> {};
101-
template <typename T>
102-
struct is_trivially_copy_constructible<T &> : std::true_type {};
103-
template <typename T>
104-
struct is_trivially_copy_constructible<T &&> : std::false_type {};
105-
106-
/// An implementation of `std::is_trivially_move_constructible` since we have
107-
/// users with STLs that don't yet include it.
108-
template <typename T>
109-
struct is_trivially_move_constructible
110-
: std::is_move_constructible<
111-
::llvm::detail::move_construction_triviality_helper<T>> {};
112-
template <typename T>
113-
struct is_trivially_move_constructible<T &> : std::true_type {};
114-
template <typename T>
115-
struct is_trivially_move_constructible<T &&> : std::true_type {};
116-
117-
11881
template <typename T>
11982
struct is_copy_assignable {
12083
template<class F>

llvm/unittests/Support/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ add_llvm_unittest(SupportTests
8080
TimerTest.cpp
8181
ToolOutputFileTest.cpp
8282
TypeNameTest.cpp
83-
TypeTraitsTest.cpp
8483
TrailingObjectsTest.cpp
8584
TrigramIndexTest.cpp
8685
UnicodeTest.cpp

llvm/unittests/Support/TypeTraitsTest.cpp

Lines changed: 0 additions & 97 deletions
This file was deleted.

llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ unittest("SupportTests") {
8585
"TrailingObjectsTest.cpp",
8686
"TrigramIndexTest.cpp",
8787
"TypeNameTest.cpp",
88-
"TypeTraitsTest.cpp",
8988
"UnicodeTest.cpp",
9089
"VersionTupleTest.cpp",
9190
"VirtualFileSystemTest.cpp",

0 commit comments

Comments
 (0)