[llvm] 91e66bf - Revert "Use std::is_trivially_copyable", breaks MSVC build

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 14:32:41 PST 2020


Author: Reid Kleckner
Date: 2020-12-02T14:30:46-08:00
New Revision: 91e66bfd321ff3e932a9f9706b22fcf455a4a686

URL: https://github.com/llvm/llvm-project/commit/91e66bfd321ff3e932a9f9706b22fcf455a4a686
DIFF: https://github.com/llvm/llvm-project/commit/91e66bfd321ff3e932a9f9706b22fcf455a4a686.diff

LOG: Revert "Use std::is_trivially_copyable", breaks MSVC build

Revert "Delete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE"

This reverts commit 4d4bd40b578d77b8c5bc349ded405fb58c333c78.

This reverts commit 557b00e0afb2dc1776f50948094ca8cc62d97be4.

Added: 
    

Modified: 
    llvm/cmake/config-ix.cmake
    llvm/docs/ProgrammersManual.rst
    llvm/include/llvm/ADT/DenseMap.h
    llvm/include/llvm/ADT/Optional.h
    llvm/include/llvm/ADT/PointerIntPair.h
    llvm/include/llvm/ADT/STLExtras.h
    llvm/include/llvm/Config/config.h.cmake
    llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
    llvm/include/llvm/Support/type_traits.h
    llvm/tools/llvm-diff/DifferenceEngine.cpp
    llvm/unittests/ADT/ArrayRefTest.cpp
    llvm/unittests/ADT/ImmutableListTest.cpp
    llvm/unittests/ADT/OptionalTest.cpp
    llvm/unittests/ADT/PointerIntPairTest.cpp
    llvm/unittests/ADT/StringRefTest.cpp
    llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
    llvm/unittests/Bitstream/BitstreamReaderTest.cpp
    llvm/unittests/CodeGen/MachineInstrTest.cpp
    llvm/unittests/CodeGen/TypeTraitsTest.cpp
    llvm/unittests/IR/CFGBuilder.cpp
    llvm/unittests/Support/ScaledNumberTest.cpp
    llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index b4c54da01912..818fafbce148 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -351,6 +351,15 @@ else()
   unset(HAVE_FFI_CALL CACHE)
 endif( LLVM_ENABLE_FFI )
 
+# Whether we can use std::is_trivially_copyable to verify llvm::is_trivially_copyable.
+CHECK_CXX_SOURCE_COMPILES("
+#include <type_traits>
+struct T { int val; };
+static_assert(std::is_trivially_copyable<T>::value, \"ok\");
+int main() { return 0;}
+" HAVE_STD_IS_TRIVIALLY_COPYABLE)
+
+
 # Define LLVM_HAS_ATOMICS if gcc or MSVC atomic builtins are supported.
 include(CheckAtomic)
 

diff  --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index e303a7a18eba..d9925d69d9f6 100644
--- a/llvm/docs/ProgrammersManual.rst
+++ b/llvm/docs/ProgrammersManual.rst
@@ -1530,7 +1530,7 @@ SmallVector has grown a few other minor advantages over std::vector, causing
 #. std::vector is exception-safe, and some implementations have pessimizations
    that copy elements when SmallVector would move them.
 
-#. SmallVector understands ``std::is_trivially_copyable<Type>`` and uses realloc aggressively.
+#. SmallVector understands ``llvm::is_trivially_copyable<Type>`` and uses realloc aggressively.
 
 #. Many LLVM APIs take a SmallVectorImpl as an out parameter (see the note
    below).

diff  --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index 7f7a4593ae36..42e4fc84175c 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -426,8 +426,8 @@ class DenseMapBase : public DebugEpochBase {
     setNumEntries(other.getNumEntries());
     setNumTombstones(other.getNumTombstones());
 
-    if (std::is_trivially_copyable<KeyT>::value &&
-        std::is_trivially_copyable<ValueT>::value)
+    if (is_trivially_copyable<KeyT>::value &&
+        is_trivially_copyable<ValueT>::value)
       memcpy(reinterpret_cast<void *>(getBuckets()), other.getBuckets(),
              getNumBuckets() * sizeof(BucketT));
     else

diff  --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index 5fff0acca816..be32178cb185 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -17,10 +17,10 @@
 
 #include "llvm/ADT/None.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
 #include <new>
-#include <type_traits>
 #include <utility>
 
 namespace llvm {
@@ -32,7 +32,7 @@ namespace optional_detail {
 struct in_place_t {};
 
 /// Storage for any type.
-template <typename T, bool = std::is_trivially_copyable<T>::value>
+template <typename T, bool = is_trivially_copyable<T>::value>
 class OptionalStorage {
   union {
     char empty;

diff  --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h
index 600fcebff3ea..cb8b202c48b7 100644
--- a/llvm/include/llvm/ADT/PointerIntPair.h
+++ b/llvm/include/llvm/ADT/PointerIntPair.h
@@ -15,6 +15,7 @@
 
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
+#include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <cstdint>
 #include <limits>
@@ -126,6 +127,19 @@ class PointerIntPair {
   }
 };
 
+// Specialize is_trivially_copyable to avoid limitation of llvm::is_trivially_copyable
+// when compiled with gcc 4.9.
+template <typename PointerTy, unsigned IntBits, typename IntType,
+          typename PtrTraits,
+          typename Info>
+struct is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>> : std::true_type {
+#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
+  static_assert(std::is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>::value,
+                "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
+#endif
+};
+
+
 template <typename PointerT, unsigned IntBits, typename PtrTraits>
 struct PointerIntPairInfo {
   static_assert(PtrTraits::NumLowBitsAvailable <

diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 1d6faf6509f9..5a5d47b783c2 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -1428,7 +1428,7 @@ template <typename T>
 // is trivially copyable.
 using sort_trivially_copyable = conjunction<
     std::is_pointer<T>,
-    std::is_trivially_copyable<typename std::iterator_traits<T>::value_type>>;
+    is_trivially_copyable<typename std::iterator_traits<T>::value_type>>;
 } // namespace detail
 
 // Provide wrappers to std::sort which shuffle the elements before sorting

diff  --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 4da1d199db67..6664ad335584 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -332,6 +332,9 @@
 /* Define as the return type of signal handlers (`int' or `void'). */
 #cmakedefine RETSIGTYPE ${RETSIGTYPE}
 
+/* Define if std::is_trivially_copyable is supported */
+#cmakedefine HAVE_STD_IS_TRIVIALLY_COPYABLE ${HAVE_STD_IS_TRIVIALLY_COPYABLE}
+
 /* Define to a function implementing stricmp */
 #cmakedefine stricmp ${stricmp}
 

diff  --git a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
index 9f34d026b1ba..e6ade770457c 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
@@ -171,10 +171,15 @@ struct GloballyHashedType {
     return Hashes;
   }
 };
+#if defined(_MSC_VER)
+// is_trivially_copyable is not available in older versions of libc++, but it is
+// available in all supported versions of MSVC, so at least this gives us some
+// coverage.
 static_assert(std::is_trivially_copyable<GloballyHashedType>::value,
               "GloballyHashedType must be trivially copyable so that we can "
               "reinterpret_cast arrays of hash data to arrays of "
               "GloballyHashedType");
+#endif
 } // namespace codeview
 
 template <> struct DenseMapInfo<codeview::LocallyHashedType> {

diff  --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
index 383f087f4bc2..7b7d5d991f3f 100644
--- a/llvm/include/llvm/Support/type_traits.h
+++ b/llvm/include/llvm/Support/type_traits.h
@@ -85,6 +85,11 @@ template<typename T> union move_construction_triviality_helper {
     ~move_construction_triviality_helper() = default;
 };
 
+template<class T>
+union trivial_helper {
+    T t;
+};
+
 } // end namespace detail
 
 /// An implementation of `std::is_trivially_copy_constructible` since we have
@@ -109,6 +114,78 @@ struct is_trivially_move_constructible<T &> : std::true_type {};
 template <typename T>
 struct is_trivially_move_constructible<T &&> : std::true_type {};
 
+
+template <typename T>
+struct is_copy_assignable {
+  template<class F>
+    static auto get(F*) -> decltype(std::declval<F &>() = std::declval<const F &>(), std::true_type{});
+    static std::false_type get(...);
+    static constexpr bool value = decltype(get((T*)nullptr))::value;
+};
+
+template <typename T>
+struct is_move_assignable {
+  template<class F>
+    static auto get(F*) -> decltype(std::declval<F &>() = std::declval<F &&>(), std::true_type{});
+    static std::false_type get(...);
+    static constexpr bool value = decltype(get((T*)nullptr))::value;
+};
+
+
+// An implementation of `std::is_trivially_copyable` since STL version
+// is not equally supported by all compilers, especially GCC 4.9.
+// Uniform implementation of this trait is important for ABI compatibility
+// as it has an impact on SmallVector's ABI (among others).
+template <typename T>
+class is_trivially_copyable {
+
+  // copy constructors
+  static constexpr bool has_trivial_copy_constructor =
+      std::is_copy_constructible<detail::trivial_helper<T>>::value;
+  static constexpr bool has_deleted_copy_constructor =
+      !std::is_copy_constructible<T>::value;
+
+  // move constructors
+  static constexpr bool has_trivial_move_constructor =
+      std::is_move_constructible<detail::trivial_helper<T>>::value;
+  static constexpr bool has_deleted_move_constructor =
+      !std::is_move_constructible<T>::value;
+
+  // copy assign
+  static constexpr bool has_trivial_copy_assign =
+      is_copy_assignable<detail::trivial_helper<T>>::value;
+  static constexpr bool has_deleted_copy_assign =
+      !is_copy_assignable<T>::value;
+
+  // move assign
+  static constexpr bool has_trivial_move_assign =
+      is_move_assignable<detail::trivial_helper<T>>::value;
+  static constexpr bool has_deleted_move_assign =
+      !is_move_assignable<T>::value;
+
+  // destructor
+  static constexpr bool has_trivial_destructor =
+      std::is_destructible<detail::trivial_helper<T>>::value;
+
+  public:
+
+  static constexpr bool value =
+      has_trivial_destructor &&
+      (has_deleted_move_assign || has_trivial_move_assign) &&
+      (has_deleted_move_constructor || has_trivial_move_constructor) &&
+      (has_deleted_copy_assign || has_trivial_copy_assign) &&
+      (has_deleted_copy_constructor || has_trivial_copy_constructor);
+
+#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
+  static_assert(value == std::is_trivially_copyable<T>::value,
+                "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
+#endif
+};
+template <typename T>
+class is_trivially_copyable<T*> : public std::true_type {
+};
+
+
 } // end namespace llvm
 
 #endif // LLVM_SUPPORT_TYPE_TRAITS_H

diff  --git a/llvm/tools/llvm-
diff /DifferenceEngine.cpp b/llvm/tools/llvm-
diff /DifferenceEngine.cpp
index 64c0dc61e806..2cf1afbc6af5 100644
--- a/llvm/tools/llvm-
diff /DifferenceEngine.cpp
+++ b/llvm/tools/llvm-
diff /DifferenceEngine.cpp
@@ -67,7 +67,7 @@ class PriorityQueue {
     unsigned NewSize = Storage.size() - 1;
     if (NewSize) {
       // Move the slot at the end to the beginning.
-      if (std::is_trivially_copyable<T>::value)
+      if (is_trivially_copyable<T>::value)
         Storage[0] = Storage[NewSize];
       else
         std::swap(Storage[0], Storage[NewSize]);

diff  --git a/llvm/unittests/ADT/ArrayRefTest.cpp b/llvm/unittests/ADT/ArrayRefTest.cpp
index f3da4c675a85..4690319ae52e 100644
--- a/llvm/unittests/ADT/ArrayRefTest.cpp
+++ b/llvm/unittests/ADT/ArrayRefTest.cpp
@@ -262,7 +262,7 @@ TEST(ArrayRefTest, makeArrayRefFromStdArray) {
   }
 }
 
-static_assert(std::is_trivially_copyable<ArrayRef<int>>::value,
+static_assert(is_trivially_copyable<ArrayRef<int>>::value,
               "trivially copyable");
 
 } // end anonymous namespace

diff  --git a/llvm/unittests/ADT/ImmutableListTest.cpp b/llvm/unittests/ADT/ImmutableListTest.cpp
index ab3b8b472b90..b0b1e0e6c29f 100644
--- a/llvm/unittests/ADT/ImmutableListTest.cpp
+++ b/llvm/unittests/ADT/ImmutableListTest.cpp
@@ -267,7 +267,7 @@ TEST_F(ImmutableListTest, LongListOrderingTest) {
   ASSERT_EQ(6, i);
 }
 
-static_assert(std::is_trivially_copyable<ImmutableList<Wrapper<long>>>::value,
+static_assert(is_trivially_copyable<ImmutableList<Wrapper<long>>>::value,
               "trivially copyable");
 
 } // namespace

diff  --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp
index 7506453c4d90..249c9268bcfd 100644
--- a/llvm/unittests/ADT/OptionalTest.cpp
+++ b/llvm/unittests/ADT/OptionalTest.cpp
@@ -17,10 +17,10 @@
 
 using namespace llvm;
 
-static_assert(std::is_trivially_copyable<Optional<int>>::value,
-              "trivially copyable");
+static_assert(is_trivially_copyable<Optional<int>>::value,
+          "trivially copyable");
 
-static_assert(std::is_trivially_copyable<Optional<std::array<int, 3>>>::value,
+static_assert(is_trivially_copyable<Optional<std::array<int, 3>>>::value,
               "trivially copyable");
 
 void OptionalWorksInConstexpr() {
@@ -66,8 +66,8 @@ unsigned NonDefaultConstructible::Destructions = 0;
 unsigned NonDefaultConstructible::CopyAssignments = 0;
 
 static_assert(
-    !std::is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
-    "not trivially copyable");
+      !is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
+      "not trivially copyable");
 
 // Test fixture
 class OptionalTest : public testing::Test {
@@ -227,8 +227,9 @@ struct MultiArgConstructor {
 };
 unsigned MultiArgConstructor::Destructions = 0;
 
-static_assert(!std::is_trivially_copyable<Optional<MultiArgConstructor>>::value,
-              "not trivially copyable");
+static_assert(
+  !is_trivially_copyable<Optional<MultiArgConstructor>>::value,
+  "not trivially copyable");
 
 TEST_F(OptionalTest, Emplace) {
   MultiArgConstructor::ResetCounts();
@@ -277,7 +278,7 @@ unsigned MoveOnly::MoveConstructions = 0;
 unsigned MoveOnly::Destructions = 0;
 unsigned MoveOnly::MoveAssignments = 0;
 
-static_assert(!std::is_trivially_copyable<Optional<MoveOnly>>::value,
+static_assert(!is_trivially_copyable<Optional<MoveOnly>>::value,
               "not trivially copyable");
 
 TEST_F(OptionalTest, MoveOnlyNull) {
@@ -381,7 +382,7 @@ struct Immovable {
 unsigned Immovable::Constructions = 0;
 unsigned Immovable::Destructions = 0;
 
-static_assert(!std::is_trivially_copyable<Optional<Immovable>>::value,
+static_assert(!is_trivially_copyable<Optional<Immovable>>::value,
               "not trivially copyable");
 
 TEST_F(OptionalTest, ImmovableEmplace) {

diff  --git a/llvm/unittests/ADT/PointerIntPairTest.cpp b/llvm/unittests/ADT/PointerIntPairTest.cpp
index 8a42e5b9f557..b8ba3e32b288 100644
--- a/llvm/unittests/ADT/PointerIntPairTest.cpp
+++ b/llvm/unittests/ADT/PointerIntPairTest.cpp
@@ -62,7 +62,7 @@ TEST(PointerIntPairTest, GetSet) {
   EXPECT_EQ(&s, Pair2.getPointer());
   EXPECT_EQ(E::Case3, Pair2.getInt());
 
-  static_assert(std::is_trivially_copyable<PointerIntPair<S *, 2, E>>::value,
+  static_assert(is_trivially_copyable<PointerIntPair<S *, 2, E>>::value,
                 "trivially copyable");
 }
 
@@ -101,7 +101,7 @@ TEST(PointerIntPairTest, ManyUnusedBits) {
             (int)PointerLikeTypeTraits<decltype(pair)>::NumLowBitsAvailable);
 
   static_assert(
-      std::is_trivially_copyable<
+      is_trivially_copyable<
           PointerIntPair<Fixnum31, 1, bool, FixnumPointerTraits>>::value,
       "trivially copyable");
 }

diff  --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp
index 50e38c50f621..fbf2d8422a44 100644
--- a/llvm/unittests/ADT/StringRefTest.cpp
+++ b/llvm/unittests/ADT/StringRefTest.cpp
@@ -1087,7 +1087,6 @@ TEST(StringRefTest, GTestPrinter) {
   EXPECT_EQ(R"("foo")", ::testing::PrintToString(StringRef("foo")));
 }
 
-static_assert(std::is_trivially_copyable<StringRef>::value,
-              "trivially copyable");
+static_assert(is_trivially_copyable<StringRef>::value, "trivially copyable");
 
 } // end anonymous namespace

diff  --git a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
index 5dd399517164..2aeba947a745 100644
--- a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
+++ b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
@@ -91,7 +91,7 @@ TEST_F(BlockFrequencyInfoTest, Basic) {
   EXPECT_EQ(BFI.getBlockFreq(BB3).getFrequency(), BB3Freq);
 }
 
-static_assert(std::is_trivially_copyable<bfi_detail::BlockMass>::value,
+static_assert(is_trivially_copyable<bfi_detail::BlockMass>::value,
               "trivially copyable");
 
 } // end anonymous namespace

diff  --git a/llvm/unittests/Bitstream/BitstreamReaderTest.cpp b/llvm/unittests/Bitstream/BitstreamReaderTest.cpp
index 669288e42647..f58af220f2d1 100644
--- a/llvm/unittests/Bitstream/BitstreamReaderTest.cpp
+++ b/llvm/unittests/Bitstream/BitstreamReaderTest.cpp
@@ -161,7 +161,7 @@ TEST(BitstreamReaderTest, shortRead) {
   }
 }
 
-static_assert(std::is_trivially_copyable<BitCodeAbbrevOp>::value,
+static_assert(is_trivially_copyable<BitCodeAbbrevOp>::value,
               "trivially copyable");
 
 } // end anonymous namespace

diff  --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 7c9faeca829b..33baaf62efdf 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -383,7 +383,6 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
   ASSERT_FALSE(MI->getHeapAllocMarker());
 }
 
-static_assert(std::is_trivially_copyable<MCOperand>::value,
-              "trivially copyable");
+static_assert(is_trivially_copyable<MCOperand>::value, "trivially copyable");
 
 } // end namespace

diff  --git a/llvm/unittests/CodeGen/TypeTraitsTest.cpp b/llvm/unittests/CodeGen/TypeTraitsTest.cpp
index 7287ac363ba6..840375bd4ab5 100644
--- a/llvm/unittests/CodeGen/TypeTraitsTest.cpp
+++ b/llvm/unittests/CodeGen/TypeTraitsTest.cpp
@@ -12,15 +12,14 @@
 #include "llvm/CodeGen/SlotIndexes.h"
 #include "llvm/CodeGen/TargetPassConfig.h"
 #include "gtest/gtest.h"
-#include <type_traits>
 
 using namespace llvm;
 
 #if __has_feature(is_trivially_copyable) || (defined(__GNUC__) && __GNUC__ >= 5)
-static_assert(std::is_trivially_copyable<PressureChange>::value, "trivially copyable");
-static_assert(std::is_trivially_copyable<SDep>::value, "trivially copyable");
-static_assert(std::is_trivially_copyable<SDValue>::value, "trivially copyable");
-static_assert(std::is_trivially_copyable<SlotIndex>::value, "trivially copyable");
-static_assert(std::is_trivially_copyable<IdentifyingPassPtr>::value, "trivially copyable");
+static_assert(is_trivially_copyable<PressureChange>::value, "trivially copyable");
+static_assert(is_trivially_copyable<SDep>::value, "trivially copyable");
+static_assert(is_trivially_copyable<SDValue>::value, "trivially copyable");
+static_assert(is_trivially_copyable<SlotIndex>::value, "trivially copyable");
+static_assert(is_trivially_copyable<IdentifyingPassPtr>::value, "trivially copyable");
 #endif
 

diff  --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp
index c9bc52ca7a66..3583ab2a8a55 100644
--- a/llvm/unittests/IR/CFGBuilder.cpp
+++ b/llvm/unittests/IR/CFGBuilder.cpp
@@ -267,11 +267,10 @@ TEST(CFGBuilder, Rebuild) {
   EXPECT_TRUE(isa<SwitchInst>(B.getOrAddBlock("d")->getTerminator()));
 }
 
-static_assert(std::is_trivially_copyable<succ_iterator>::value,
+static_assert(is_trivially_copyable<succ_iterator>::value,
               "trivially copyable");
-static_assert(std::is_trivially_copyable<const_succ_iterator>::value,
+static_assert(is_trivially_copyable<const_succ_iterator>::value,
               "trivially copyable");
-static_assert(std::is_trivially_copyable<succ_range>::value,
-              "trivially copyable");
-static_assert(std::is_trivially_copyable<const_succ_range>::value,
+static_assert(is_trivially_copyable<succ_range>::value, "trivially copyable");
+static_assert(is_trivially_copyable<const_succ_range>::value,
               "trivially copyable");

diff  --git a/llvm/unittests/Support/ScaledNumberTest.cpp b/llvm/unittests/Support/ScaledNumberTest.cpp
index 82ecce09444d..3fa63b7bf3c7 100644
--- a/llvm/unittests/Support/ScaledNumberTest.cpp
+++ b/llvm/unittests/Support/ScaledNumberTest.cpp
@@ -562,7 +562,7 @@ TEST(ScaledNumberHelpersTest, toIntBug) {
   EXPECT_EQ(1u, (n * n).toInt<uint32_t>());
 }
 
-static_assert(std::is_trivially_copyable<ScaledNumber<uint32_t>>::value,
+static_assert(is_trivially_copyable<ScaledNumber<uint32_t>>::value,
               "trivially copyable");
 
 } // end namespace

diff  --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 193a59490560..389d5e962bc9 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -89,6 +89,7 @@ write_cmake_config("config") {
     "HAVE_LIBPSAPI=",
     "HAVE_MALLCTL=",
     "HAVE_SIGNAL_H=1",
+    "HAVE_STD_IS_TRIVIALLY_COPYABLE=1",
     "HAVE_STRERROR=1",
     "HAVE_SYS_STAT_H=1",
     "HAVE_SYS_TYPES_H=1",


        


More information about the llvm-commits mailing list