diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -1530,7 +1530,7 @@ #. std::vector is exception-safe, and some implementations have pessimizations that copy elements when SmallVector would move them. -#. SmallVector understands ``llvm::is_trivially_copyable`` and uses realloc aggressively. +#. SmallVector understands ``std::is_trivially_copyable`` 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 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -426,8 +426,8 @@ setNumEntries(other.getNumEntries()); setNumTombstones(other.getNumTombstones()); - if (is_trivially_copyable::value && - is_trivially_copyable::value) + if (std::is_trivially_copyable::value && + std::is_trivially_copyable::value) memcpy(reinterpret_cast(getBuckets()), other.getBuckets(), getNumBuckets() * sizeof(BucketT)); else diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -1428,7 +1428,7 @@ // is trivially copyable. using sort_trivially_copyable = conjunction< std::is_pointer, - is_trivially_copyable::value_type>>; + std::is_trivially_copyable::value_type>>; } // namespace detail // Provide wrappers to std::sort which shuffle the elements before sorting diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h --- a/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h @@ -171,15 +171,10 @@ 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::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 { diff --git a/llvm/tools/llvm-diff/DifferenceEngine.cpp b/llvm/tools/llvm-diff/DifferenceEngine.cpp --- a/llvm/tools/llvm-diff/DifferenceEngine.cpp +++ b/llvm/tools/llvm-diff/DifferenceEngine.cpp @@ -67,7 +67,7 @@ unsigned NewSize = Storage.size() - 1; if (NewSize) { // Move the slot at the end to the beginning. - if (is_trivially_copyable::value) + if (std::is_trivially_copyable::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 --- a/llvm/unittests/ADT/ArrayRefTest.cpp +++ b/llvm/unittests/ADT/ArrayRefTest.cpp @@ -262,7 +262,7 @@ } } -static_assert(is_trivially_copyable>::value, +static_assert(std::is_trivially_copyable>::value, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/ADT/ImmutableListTest.cpp b/llvm/unittests/ADT/ImmutableListTest.cpp --- a/llvm/unittests/ADT/ImmutableListTest.cpp +++ b/llvm/unittests/ADT/ImmutableListTest.cpp @@ -267,7 +267,7 @@ ASSERT_EQ(6, i); } -static_assert(is_trivially_copyable>>::value, +static_assert(std::is_trivially_copyable>>::value, "trivially copyable"); } // namespace diff --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp --- a/llvm/unittests/ADT/OptionalTest.cpp +++ b/llvm/unittests/ADT/OptionalTest.cpp @@ -17,10 +17,10 @@ using namespace llvm; -static_assert(is_trivially_copyable>::value, - "trivially copyable"); +static_assert(std::is_trivially_copyable>::value, + "trivially copyable"); -static_assert(is_trivially_copyable>>::value, +static_assert(std::is_trivially_copyable>>::value, "trivially copyable"); void OptionalWorksInConstexpr() { @@ -66,8 +66,8 @@ unsigned NonDefaultConstructible::CopyAssignments = 0; static_assert( - !is_trivially_copyable>::value, - "not trivially copyable"); + !std::is_trivially_copyable>::value, + "not trivially copyable"); // Test fixture class OptionalTest : public testing::Test { @@ -227,9 +227,8 @@ }; unsigned MultiArgConstructor::Destructions = 0; -static_assert( - !is_trivially_copyable>::value, - "not trivially copyable"); +static_assert(!std::is_trivially_copyable>::value, + "not trivially copyable"); TEST_F(OptionalTest, Emplace) { MultiArgConstructor::ResetCounts(); @@ -278,7 +277,7 @@ unsigned MoveOnly::Destructions = 0; unsigned MoveOnly::MoveAssignments = 0; -static_assert(!is_trivially_copyable>::value, +static_assert(!std::is_trivially_copyable>::value, "not trivially copyable"); TEST_F(OptionalTest, MoveOnlyNull) { @@ -382,7 +381,7 @@ unsigned Immovable::Constructions = 0; unsigned Immovable::Destructions = 0; -static_assert(!is_trivially_copyable>::value, +static_assert(!std::is_trivially_copyable>::value, "not trivially copyable"); TEST_F(OptionalTest, ImmovableEmplace) { diff --git a/llvm/unittests/ADT/PointerIntPairTest.cpp b/llvm/unittests/ADT/PointerIntPairTest.cpp --- a/llvm/unittests/ADT/PointerIntPairTest.cpp +++ b/llvm/unittests/ADT/PointerIntPairTest.cpp @@ -62,7 +62,7 @@ EXPECT_EQ(&s, Pair2.getPointer()); EXPECT_EQ(E::Case3, Pair2.getInt()); - static_assert(is_trivially_copyable>::value, + static_assert(std::is_trivially_copyable>::value, "trivially copyable"); } @@ -101,7 +101,7 @@ (int)PointerLikeTypeTraits::NumLowBitsAvailable); static_assert( - is_trivially_copyable< + std::is_trivially_copyable< PointerIntPair>::value, "trivially copyable"); } diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -1087,6 +1087,7 @@ EXPECT_EQ(R"("foo")", ::testing::PrintToString(StringRef("foo"))); } -static_assert(is_trivially_copyable::value, "trivially copyable"); +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp --- a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp +++ b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp @@ -91,7 +91,7 @@ EXPECT_EQ(BFI.getBlockFreq(BB3).getFrequency(), BB3Freq); } -static_assert(is_trivially_copyable::value, +static_assert(std::is_trivially_copyable::value, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/Bitstream/BitstreamReaderTest.cpp b/llvm/unittests/Bitstream/BitstreamReaderTest.cpp --- a/llvm/unittests/Bitstream/BitstreamReaderTest.cpp +++ b/llvm/unittests/Bitstream/BitstreamReaderTest.cpp @@ -161,7 +161,7 @@ } } -static_assert(is_trivially_copyable::value, +static_assert(std::is_trivially_copyable::value, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp --- a/llvm/unittests/CodeGen/MachineInstrTest.cpp +++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp @@ -383,6 +383,7 @@ ASSERT_FALSE(MI->getHeapAllocMarker()); } -static_assert(is_trivially_copyable::value, "trivially copyable"); +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); } // end namespace diff --git a/llvm/unittests/CodeGen/TypeTraitsTest.cpp b/llvm/unittests/CodeGen/TypeTraitsTest.cpp --- a/llvm/unittests/CodeGen/TypeTraitsTest.cpp +++ b/llvm/unittests/CodeGen/TypeTraitsTest.cpp @@ -12,14 +12,18 @@ #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/TargetPassConfig.h" #include "gtest/gtest.h" +#include using namespace llvm; #if __has_feature(is_trivially_copyable) || (defined(__GNUC__) && __GNUC__ >= 5) -static_assert(is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, "trivially copyable"); +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); +static_assert(std::is_trivially_copyable::value, "trivially copyable"); +static_assert(std::is_trivially_copyable::value, "trivially copyable"); +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); #endif diff --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp --- a/llvm/unittests/IR/CFGBuilder.cpp +++ b/llvm/unittests/IR/CFGBuilder.cpp @@ -267,10 +267,11 @@ EXPECT_TRUE(isa(B.getOrAddBlock("d")->getTerminator())); } -static_assert(is_trivially_copyable::value, +static_assert(std::is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, +static_assert(std::is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, "trivially copyable"); -static_assert(is_trivially_copyable::value, +static_assert(std::is_trivially_copyable::value, + "trivially copyable"); +static_assert(std::is_trivially_copyable::value, "trivially copyable"); diff --git a/llvm/unittests/Support/ScaledNumberTest.cpp b/llvm/unittests/Support/ScaledNumberTest.cpp --- a/llvm/unittests/Support/ScaledNumberTest.cpp +++ b/llvm/unittests/Support/ScaledNumberTest.cpp @@ -562,7 +562,7 @@ EXPECT_EQ(1u, (n * n).toInt()); } -static_assert(is_trivially_copyable>::value, +static_assert(std::is_trivially_copyable>::value, "trivially copyable"); } // end namespace