diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h --- a/llvm/include/llvm/ADT/FunctionExtras.h +++ b/llvm/include/llvm/ADT/FunctionExtras.h @@ -57,7 +57,7 @@ template using EnableIfTrivial = - std::enable_if_t::value && + std::enable_if_t::value && std::is_trivially_destructible::value>; template class UniqueFunctionBase { @@ -83,8 +83,8 @@ template using AdjustedParamT = typename std::conditional< !std::is_reference::value && - llvm::is_trivially_copy_constructible::value && - llvm::is_trivially_move_constructible::value && + std::is_trivially_copy_constructible::value && + std::is_trivially_move_constructible::value && IsSizeLessThanThresholdT::value, T, T &>::type; diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -278,8 +278,8 @@ /// copy these types with memcpy, there is no way for the type to observe this. /// This catches the important case of std::pair, which is not /// trivially assignable. -template ::value) && - (is_trivially_move_constructible::value) && +template ::value) && + (std::is_trivially_move_constructible::value) && std::is_trivially_destructible::value> class SmallVectorTemplateBase : public SmallVectorTemplateCommon { protected: diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h --- a/llvm/include/llvm/Support/type_traits.h +++ b/llvm/include/llvm/Support/type_traits.h @@ -70,20 +70,6 @@ }; namespace detail { -/// Internal utility to detect trivial copy construction. -template union copy_construction_triviality_helper { - T t; - copy_construction_triviality_helper() = default; - copy_construction_triviality_helper(const copy_construction_triviality_helper&) = default; - ~copy_construction_triviality_helper() = default; -}; -/// Internal utility to detect trivial move construction. -template union move_construction_triviality_helper { - T t; - move_construction_triviality_helper() = default; - move_construction_triviality_helper(move_construction_triviality_helper&&) = default; - ~move_construction_triviality_helper() = default; -}; template union trivial_helper { @@ -92,29 +78,6 @@ } // end namespace detail -/// An implementation of `std::is_trivially_copy_constructible` since we have -/// users with STLs that don't yet include it. -template -struct is_trivially_copy_constructible - : std::is_copy_constructible< - ::llvm::detail::copy_construction_triviality_helper> {}; -template -struct is_trivially_copy_constructible : std::true_type {}; -template -struct is_trivially_copy_constructible : std::false_type {}; - -/// An implementation of `std::is_trivially_move_constructible` since we have -/// users with STLs that don't yet include it. -template -struct is_trivially_move_constructible - : std::is_move_constructible< - ::llvm::detail::move_construction_triviality_helper> {}; -template -struct is_trivially_move_constructible : std::true_type {}; -template -struct is_trivially_move_constructible : std::true_type {}; - - template struct is_copy_assignable { template diff --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt --- a/llvm/unittests/Support/CMakeLists.txt +++ b/llvm/unittests/Support/CMakeLists.txt @@ -80,7 +80,6 @@ TimerTest.cpp ToolOutputFileTest.cpp TypeNameTest.cpp - TypeTraitsTest.cpp TrailingObjectsTest.cpp TrigramIndexTest.cpp UnicodeTest.cpp diff --git a/llvm/unittests/Support/TypeTraitsTest.cpp b/llvm/unittests/Support/TypeTraitsTest.cpp deleted file mode 100644 --- a/llvm/unittests/Support/TypeTraitsTest.cpp +++ /dev/null @@ -1,97 +0,0 @@ -//===- TypeTraitsTest.cpp -------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#include "llvm/Support/type_traits.h" -#include "gtest/gtest.h" - -namespace { - -// Compile-time tests using static assert. -namespace triviality { - -// Helper for compile time checking trivially copy constructible and trivially -// move constructible type traits. -template -void TrivialityTester() { - static_assert(llvm::is_trivially_copy_constructible::value == - IsTriviallyCopyConstructible, - "Mismatch in expected trivial copy construction!"); - static_assert(llvm::is_trivially_move_constructible::value == - IsTriviallyMoveConstructible, - "Mismatch in expected trivial move construction!"); - -#if defined(_LIBCPP_VERSION) || defined(_MSC_VER) - // On compilers with support for the standard traits, make sure they agree. - static_assert(std::is_trivially_copy_constructible::value == - IsTriviallyCopyConstructible, - "Mismatch in expected trivial copy construction!"); - static_assert(std::is_trivially_move_constructible::value == - IsTriviallyMoveConstructible, - "Mismatch in expected trivial move construction!"); -#endif -} - -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); - -struct X {}; -struct Y { - Y(const Y &); -}; -struct Z { - Z(const Z &); - Z(Z &&); -}; -struct A { - A(const A &) = default; - A(A &&); -}; -struct B { - B(const B &); - B(B &&) = default; -}; - -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); - -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); -template void TrivialityTester(); - -TEST(Triviality, Tester) { - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); - TrivialityTester(); -} - -} // namespace triviality - -} // end anonymous namespace diff --git a/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn --- a/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn @@ -85,7 +85,6 @@ "TrailingObjectsTest.cpp", "TrigramIndexTest.cpp", "TypeNameTest.cpp", - "TypeTraitsTest.cpp", "UnicodeTest.cpp", "VersionTupleTest.cpp", "VirtualFileSystemTest.cpp",