diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -2019,9 +2019,8 @@ namespace llvm { \ namespace yaml { \ static_assert( \ - !std::is_fundamental::value && \ - !std::is_same::value && \ - !std::is_same::value, \ + !std::is_fundamental_v && !std::is_same_v && \ + !std::is_same_v, \ "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"); \ template <> struct SequenceElementTraits { \ static const bool flow = FLOW; \ diff --git a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp --- a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp @@ -237,8 +237,7 @@ } template static LocIndex fromRawInteger(IntT ID) { - static_assert(std::is_unsigned::value && - sizeof(ID) == sizeof(uint64_t), + static_assert(std::is_unsigned_v && sizeof(ID) == sizeof(uint64_t), "Cannot convert raw integer to LocIndex"); return {static_cast(ID >> 32), static_cast(ID)}; diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp --- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp +++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp @@ -14,7 +14,7 @@ using namespace codeview; #define CV_ENUM_CLASS_ENT(enum_class, enum) \ - { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) } + { #enum, std::underlying_type_t(enum_class::enum) } #define CV_ENUM_ENT(ns, enum) \ { #enum, ns::enum } diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp --- a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp @@ -27,7 +27,7 @@ }; #define ENUM_ENTRY(enum_class, enum) \ - { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) } + { #enum, std::underlying_type_t(enum_class::enum) } static const EnumEntry ClassOptionNames[] = { ENUM_ENTRY(ClassOptions, Packed), diff --git a/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp b/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp --- a/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp @@ -14,7 +14,7 @@ using namespace llvm::pdb; #define PDB_ENUM_CLASS_ENT(enum_class, enum) \ - { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) } + { #enum, std::underlying_type_t(enum_class::enum) } #define PDB_ENUM_ENT(ns, enum) \ { #enum, ns::enum } diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp --- a/llvm/lib/Object/DXContainer.cpp +++ b/llvm/lib/Object/DXContainer.cpp @@ -32,7 +32,7 @@ template static Error readInteger(StringRef Buffer, const char *Src, T &Val) { - static_assert(std::is_integral::value, + static_assert(std::is_integral_v, "Cannot call readInteger on non-integral type."); // Don't read before the beginning or past the end of the file if (Src < Buffer.begin() || Src + sizeof(T) > Buffer.end()) diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -1351,7 +1351,7 @@ Expected
Header::readFromBuffer(const unsigned char *Buffer) { using namespace support; - static_assert(std::is_standard_layout
::value, + static_assert(std::is_standard_layout_v
, "The header should be standard layout type since we use offset " "of fields to read."); Header H; diff --git a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp --- a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp +++ b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp @@ -27,8 +27,7 @@ ID.AddString(llvm::StringRef(Str.begin(), Str.size())); } template - std::enable_if_t::value || std::is_enum::value> - operator()(T V) { + std::enable_if_t || std::is_enum_v> operator()(T V) { ID.AddInteger((unsigned long long)V); } void operator()(itanium_demangle::NodeArray A) { diff --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp --- a/llvm/lib/Support/NativeFormatting.cpp +++ b/llvm/lib/Support/NativeFormatting.cpp @@ -55,7 +55,7 @@ template static void write_unsigned_impl(raw_ostream &S, T N, size_t MinDigits, IntegerStyle Style, bool IsNegative) { - static_assert(std::is_unsigned::value, "Value is not unsigned!"); + static_assert(std::is_unsigned_v, "Value is not unsigned!"); char NumberBuffer[128]; std::memset(NumberBuffer, '0', sizeof(NumberBuffer)); @@ -92,7 +92,7 @@ template static void write_signed(raw_ostream &S, T N, size_t MinDigits, IntegerStyle Style) { - static_assert(std::is_signed::value, "Value is not signed!"); + static_assert(std::is_signed_v, "Value is not signed!"); using UnsignedT = std::make_unsigned_t; diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -3574,8 +3574,8 @@ static bool hasCalleePopSRet(const SmallVectorImpl &Args, const X86Subtarget &Subtarget) { // Not C++20 (yet), so no concepts available. - static_assert(std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v, "requires ISD::OutputArg or ISD::InputArg"); // Only 32-bit pops the sret. It's a 64-bit world these days, so early-out diff --git a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp --- a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp +++ b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp @@ -576,13 +576,13 @@ } template static SCEVTypes convertToSCEVype(MaxMinT &MM) { - if (std::is_same::value) + if (std::is_same_v) return scSMaxExpr; - else if (std::is_same::value) + else if (std::is_same_v) return scUMaxExpr; - else if (std::is_same::value) + else if (std::is_same_v) return scSMinExpr; - else if (std::is_same::value) + else if (std::is_same_v) return scUMinExpr; llvm_unreachable("Can't convert MinMax pattern to SCEV type"); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7279,12 +7279,11 @@ /// value, otherwise. struct ValueSelect { template - static std::enable_if_t::value, Value *> - get(Value *V) { + static std::enable_if_t, Value *> get(Value *V) { return V; } template - static std::enable_if_t::value, U> get(Value *) { + static std::enable_if_t, U> get(Value *) { return U(); } }; diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -256,8 +256,8 @@ "This test makes sure NewArchiveMemberList is used by MembersData since " "the following asserts test invariants required for MembersData."); static_assert( - !std::is_copy_constructible< - decltype(NewArchiveMemberList::Members)::value_type>::value, + !std::is_copy_constructible_v< + decltype(NewArchiveMemberList::Members)::value_type>, "MembersData::MembersPerArchitecture has a dependency on " "MembersData::FileBuffers so it should not be able to " "be copied on its own without FileBuffers. Unfortunately, " @@ -265,8 +265,8 @@ "of a non-copyable type is itself non-copyable so we have to test the " "actual type of the stored data (ie, value_type)."); static_assert( - !std::is_copy_assignable< - decltype(NewArchiveMemberList::Members)::value_type>::value, + !std::is_copy_assignable_v< + decltype(NewArchiveMemberList::Members)::value_type>, "MembersData::MembersPerArchitecture has a dependency on " "MembersData::FileBuffers so it should not be able to " "be copied on its own without FileBuffers. Unfortunately, " 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 @@ -16,34 +16,27 @@ // Check that the ArrayRef-of-pointer converting constructor only allows adding // cv qualifiers (not removing them, or otherwise changing the type) -static_assert( - std::is_convertible, ArrayRef>::value, - "Adding const"); -static_assert( - std::is_convertible, ArrayRef>::value, - "Adding volatile"); -static_assert(!std::is_convertible, ArrayRef>::value, +static_assert(std::is_convertible_v, ArrayRef>, + "Adding const"); +static_assert(std::is_convertible_v, ArrayRef>, + "Adding volatile"); +static_assert(!std::is_convertible_v, ArrayRef>, "Changing pointer of one type to a pointer of another"); -static_assert( - !std::is_convertible, ArrayRef>::value, - "Removing const"); -static_assert( - !std::is_convertible, ArrayRef>::value, - "Removing volatile"); +static_assert(!std::is_convertible_v, ArrayRef>, + "Removing const"); +static_assert(!std::is_convertible_v, ArrayRef>, + "Removing volatile"); // Check that we can't accidentally assign a temporary location to an ArrayRef. // (Unfortunately we can't make use of the same thing with constructors.) +static_assert(!std::is_assignable_v &, int *>, + "Assigning from single prvalue element"); +static_assert(!std::is_assignable_v &, int *&&>, + "Assigning from single xvalue element"); +static_assert(std::is_assignable_v &, int *&>, + "Assigning from single lvalue element"); static_assert( - !std::is_assignable&, int *>::value, - "Assigning from single prvalue element"); -static_assert( - !std::is_assignable&, int * &&>::value, - "Assigning from single xvalue element"); -static_assert( - std::is_assignable&, int * &>::value, - "Assigning from single lvalue element"); -static_assert( - !std::is_assignable&, std::initializer_list>::value, + !std::is_assignable_v &, std::initializer_list>, "Assigning from an initializer list"); namespace { @@ -261,7 +254,7 @@ } } -static_assert(std::is_trivially_copyable>::value, +static_assert(std::is_trivially_copyable_v>, "trivially copyable"); TEST(ArrayRefTest, makeMutableArrayRef) { diff --git a/llvm/unittests/ADT/DenseMapTest.cpp b/llvm/unittests/ADT/DenseMapTest.cpp --- a/llvm/unittests/ADT/DenseMapTest.cpp +++ b/llvm/unittests/ADT/DenseMapTest.cpp @@ -682,7 +682,7 @@ namespace llvm { template -struct DenseMapInfo::value>> { +struct DenseMapInfo>> { static inline T getEmptyKey() { return {static_cast(~0)}; } static inline T getTombstoneKey() { return {static_cast(~0U - 1)}; } static unsigned getHashValue(const T &Val) { return Val.value; } diff --git a/llvm/unittests/ADT/DenseSetTest.cpp b/llvm/unittests/ADT/DenseSetTest.cpp --- a/llvm/unittests/ADT/DenseSetTest.cpp +++ b/llvm/unittests/ADT/DenseSetTest.cpp @@ -14,12 +14,14 @@ namespace { -static_assert(std::is_const::const_iterator::pointer>::type>::value, - "Iterator pointer type should be const"); -static_assert(std::is_const::const_iterator::reference>::type>::value, - "Iterator reference type should be const"); +static_assert( + std::is_const_v< + std::remove_pointer_t::const_iterator::pointer>>, + "Iterator pointer type should be const"); +static_assert( + std::is_const_v< + std::remove_reference_t::const_iterator::reference>>, + "Iterator reference type should be const"); // Test hashing with a set of only two entries. TEST(DenseSetTest, DoubleEntrySetTest) { diff --git a/llvm/unittests/ADT/EnumeratedArrayTest.cpp b/llvm/unittests/ADT/EnumeratedArrayTest.cpp --- a/llvm/unittests/ADT/EnumeratedArrayTest.cpp +++ b/llvm/unittests/ADT/EnumeratedArrayTest.cpp @@ -106,15 +106,15 @@ using Array = EnumeratedArray; -static_assert(std::is_same::value, +static_assert(std::is_same_v, "Incorrect value_type type"); -static_assert(std::is_same::value, +static_assert(std::is_same_v, "Incorrect reference type!"); -static_assert(std::is_same::value, +static_assert(std::is_same_v, "Incorrect pointer type!"); -static_assert(std::is_same::value, +static_assert(std::is_same_v, "Incorrect const_reference type!"); -static_assert(std::is_same::value, +static_assert(std::is_same_v, "Incorrect const_pointer type!"); } // namespace diff --git a/llvm/unittests/ADT/IListIteratorTest.cpp b/llvm/unittests/ADT/IListIteratorTest.cpp --- a/llvm/unittests/ADT/IListIteratorTest.cpp +++ b/llvm/unittests/ADT/IListIteratorTest.cpp @@ -158,16 +158,14 @@ EXPECT_EQ(CL.rbegin(), const_reverse_iterator(CL.end())); // Confirm lack of implicit conversions. - static_assert(!std::is_convertible::value, + static_assert(!std::is_convertible_v, "unexpected implicit conversion"); - static_assert(!std::is_convertible::value, + static_assert(!std::is_convertible_v, + "unexpected implicit conversion"); + static_assert(!std::is_convertible_v, + "unexpected implicit conversion"); + static_assert(!std::is_convertible_v, "unexpected implicit conversion"); - static_assert( - !std::is_convertible::value, - "unexpected implicit conversion"); - static_assert( - !std::is_convertible::value, - "unexpected implicit conversion"); } } // end namespace diff --git a/llvm/unittests/ADT/IListNodeTest.cpp b/llvm/unittests/ADT/IListNodeTest.cpp --- a/llvm/unittests/ADT/IListNodeTest.cpp +++ b/llvm/unittests/ADT/IListNodeTest.cpp @@ -22,47 +22,46 @@ TEST(IListNodeTest, Options) { static_assert( - std::is_same::type, - compute_node_options>::type>::value, + std::is_same_v::type, + compute_node_options>::type>, "default tag is void"); static_assert( - !std::is_same>::type, - compute_node_options>::type>::value, + !std::is_same_v>::type, + compute_node_options>::type>, "default tag is void, different from TagA"); static_assert( - !std::is_same>::type, - compute_node_options>::type>::value, + !std::is_same_v>::type, + compute_node_options>::type>, "TagA is not TagB"); static_assert( - std::is_same< + std::is_same_v< compute_node_options>::type, compute_node_options, - ilist_tag>::type>::value, + ilist_tag>::type>, "default tag is void, even with sentinel tracking off"); static_assert( - std::is_same< + std::is_same_v< compute_node_options>::type, compute_node_options, - ilist_sentinel_tracking>::type>::value, + ilist_sentinel_tracking>::type>, "order shouldn't matter"); static_assert( - std::is_same< + std::is_same_v< compute_node_options>::type, compute_node_options, - ilist_tag>::type>::value, + ilist_tag>::type>, "default tag is void, even with sentinel tracking on"); static_assert( - std::is_same< + std::is_same_v< compute_node_options>::type, compute_node_options, - ilist_sentinel_tracking>::type>::value, + ilist_sentinel_tracking>::type>, "order shouldn't matter"); static_assert( - std::is_same< - compute_node_options, - ilist_tag>::type, - compute_node_options, - ilist_sentinel_tracking>::type>::value, + std::is_same_v, + ilist_tag>::type, + compute_node_options, + ilist_sentinel_tracking>::type>, "order shouldn't matter with real tags"); } 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 @@ -266,7 +266,7 @@ ASSERT_EQ(6, i); } -static_assert(std::is_trivially_copyable>>::value, +static_assert(std::is_trivially_copyable_v>>, "trivially copyable"); } // namespace diff --git a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp --- a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp +++ b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp @@ -101,24 +101,22 @@ struct X : RefCountedBase {}; struct Y : X {}; struct Z : RefCountedBase {}; -static_assert(!std::is_convertible &&, - IntrusiveRefCntPtr>::value, - "X&& -> Y should be rejected with SFINAE"); -static_assert(!std::is_convertible &, - IntrusiveRefCntPtr>::value, +static_assert( + !std::is_convertible_v &&, IntrusiveRefCntPtr>, + "X&& -> Y should be rejected with SFINAE"); +static_assert(!std::is_convertible_v &, + IntrusiveRefCntPtr>, "const X& -> Y should be rejected with SFINAE"); +static_assert(!std::is_convertible_v, IntrusiveRefCntPtr>, + "X -> Y should be rejected with SFINAE"); static_assert( - !std::is_convertible, IntrusiveRefCntPtr>::value, - "X -> Y should be rejected with SFINAE"); -static_assert(!std::is_convertible &&, - IntrusiveRefCntPtr>::value, - "X&& -> Z should be rejected with SFINAE"); -static_assert(!std::is_convertible &, - IntrusiveRefCntPtr>::value, + !std::is_convertible_v &&, IntrusiveRefCntPtr>, + "X&& -> Z should be rejected with SFINAE"); +static_assert(!std::is_convertible_v &, + IntrusiveRefCntPtr>, "const X& -> Z should be rejected with SFINAE"); -static_assert( - !std::is_convertible, IntrusiveRefCntPtr>::value, - "X -> Z should be rejected with SFINAE"); +static_assert(!std::is_convertible_v, IntrusiveRefCntPtr>, + "X -> Z should be rejected with SFINAE"); TEST(IntrusiveRefCntPtr, InteropsWithConvertible) { // Check converting constructors and operator=. diff --git a/llvm/unittests/ADT/IteratorTest.cpp b/llvm/unittests/ADT/IteratorTest.cpp --- a/llvm/unittests/ADT/IteratorTest.cpp +++ b/llvm/unittests/ADT/IteratorTest.cpp @@ -27,14 +27,11 @@ // Test that iterator_adaptor_base forwards typedefs, if value_type is // unchanged. -static_assert(std::is_same>::value, - ""); -static_assert( - std::is_same>::value, ""); -static_assert(std::is_same>::value, - ""); -static_assert(std::is_same>::value, +static_assert(std::is_same_v>, ""); +static_assert(std::is_same_v>, ""); +static_assert(std::is_same_v>, ""); +static_assert(std::is_same_v>, ""); // Ensure that pointe{e,r}_iterator adaptors correctly forward the category of // the underlying iterator. @@ -87,13 +84,12 @@ static_assert(&IntIterator::operator-> == &IntIterator::operator->, ""); static_assert(&IntIterator::operator[] == &IntIterator::operator[], ""); -template ::value, bool> = false> +template , bool> = false> constexpr bool canAssignFromInt(T &&) { return true; } template ::value, bool> = false> + std::enable_if_t, bool> = false> constexpr bool canAssignFromInt(T &&) { return false; } @@ -143,15 +139,17 @@ } // pointeE_iterator -static_assert(IsAdaptedIterCategorySame::value, ""); -static_assert(IsAdaptedIterCategorySame::value, ""); +static_assert( + IsAdaptedIterCategorySame_v, + ""); +static_assert(IsAdaptedIterCategorySame_v, + ""); // pointeR_iterator -static_assert(IsAdaptedIterCategorySame::value, ""); -static_assert(IsAdaptedIterCategorySame::value, ""); +static_assert( + IsAdaptedIterCategorySame_v, + ""); +static_assert(IsAdaptedIterCategorySame_v, + ""); TEST(PointeeIteratorTest, Basic) { int arr[4] = {1, 2, 3, 4}; 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 @@ -18,10 +18,10 @@ using namespace llvm; -static_assert(std::is_trivially_copyable>::value, +static_assert(std::is_trivially_copyable_v>, "trivially copyable"); -static_assert(std::is_trivially_copyable>>::value, +static_assert(std::is_trivially_copyable_v>>, "trivially copyable"); void OptionalWorksInConstexpr() { @@ -70,9 +70,8 @@ unsigned NonDefaultConstructible::Destructions = 0; unsigned NonDefaultConstructible::CopyAssignments = 0; -static_assert( - !std::is_trivially_copyable>::value, - "not trivially copyable"); +static_assert(!std::is_trivially_copyable_v>, + "not trivially copyable"); TEST(OptionalTest, NonDefaultConstructibleTest) { Optional O; @@ -241,7 +240,7 @@ }; unsigned MultiArgConstructor::Destructions = 0; -static_assert(!std::is_trivially_copyable>::value, +static_assert(!std::is_trivially_copyable_v>, "not trivially copyable"); TEST(OptionalTest, Emplace) { @@ -323,7 +322,7 @@ unsigned MoveOnly::Destructions = 0; unsigned MoveOnly::MoveAssignments = 0; -static_assert(!std::is_trivially_copyable>::value, +static_assert(!std::is_trivially_copyable_v>, "not trivially copyable"); TEST(OptionalTest, MoveOnlyNull) { @@ -427,7 +426,7 @@ unsigned Immovable::Constructions = 0; unsigned Immovable::Destructions = 0; -static_assert(!std::is_trivially_copyable>::value, +static_assert(!std::is_trivially_copyable_v>, "not trivially copyable"); TEST(OptionalTest, ImmovableEmplace) { @@ -565,7 +564,7 @@ NonTMove1 = std::move(NonTMove2); static_assert( - std::is_trivially_copyable::value, + std::is_trivially_copyable_v, "Expect Optional to still use the trivial specialization " "of OptionalStorage despite the deleted move constructor / assignment."); } 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(std::is_trivially_copyable>::value, + static_assert(std::is_trivially_copyable_v>, "trivially copyable"); } @@ -100,10 +100,9 @@ EXPECT_EQ(FixnumPointerTraits::NumLowBitsAvailable - 1, (int)PointerLikeTypeTraits::NumLowBitsAvailable); - static_assert( - std::is_trivially_copyable< - PointerIntPair>::value, - "trivially copyable"); + static_assert(std::is_trivially_copyable_v< + PointerIntPair>, + "trivially copyable"); } } // end anonymous namespace diff --git a/llvm/unittests/ADT/PointerUnionTest.cpp b/llvm/unittests/ADT/PointerUnionTest.cpp --- a/llvm/unittests/ADT/PointerUnionTest.cpp +++ b/llvm/unittests/ADT/PointerUnionTest.cpp @@ -279,13 +279,13 @@ EXPECT_EQ(dyn_cast(constd4), nullptr); auto *result1 = cast(constd4); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "type mismatch for cast with PointerUnion"); PointerUnion constd2(&d); auto *result2 = cast(constd2); EXPECT_EQ(result2, &d); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "type mismatch for cast with PointerUnion"); } diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp --- a/llvm/unittests/ADT/SmallVectorTest.cpp +++ b/llvm/unittests/ADT/SmallVectorTest.cpp @@ -1229,7 +1229,7 @@ VectorT V; template static bool isValueType() { - return std::is_same::value; + return std::is_same_v; } void SetUp() override { 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 @@ -34,24 +34,18 @@ // Check that we can't accidentally assign a temporary std::string to a // StringRef. (Unfortunately we can't make use of the same thing with // constructors.) -static_assert( - !std::is_assignable::value, - "Assigning from prvalue std::string"); -static_assert( - !std::is_assignable::value, - "Assigning from xvalue std::string"); -static_assert( - std::is_assignable::value, - "Assigning from lvalue std::string"); -static_assert( - std::is_assignable::value, - "Assigning from prvalue C string"); -static_assert( - std::is_assignable::value, - "Assigning from xvalue C string"); -static_assert( - std::is_assignable::value, - "Assigning from lvalue C string"); +static_assert(!std::is_assignable_v, + "Assigning from prvalue std::string"); +static_assert(!std::is_assignable_v, + "Assigning from xvalue std::string"); +static_assert(std::is_assignable_v, + "Assigning from lvalue std::string"); +static_assert(std::is_assignable_v, + "Assigning from prvalue C string"); +static_assert(std::is_assignable_v, + "Assigning from xvalue C string"); +static_assert(std::is_assignable_v, + "Assigning from lvalue C string"); namespace { TEST(StringRefTest, Construction) { @@ -1144,7 +1138,6 @@ EXPECT_EQ(StringRef("\n\r"), Cases[2].detectEOL()); } -static_assert(std::is_trivially_copyable::value, - "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/ADT/TypeTraitsTest.cpp b/llvm/unittests/ADT/TypeTraitsTest.cpp --- a/llvm/unittests/ADT/TypeTraitsTest.cpp +++ b/llvm/unittests/ADT/TypeTraitsTest.cpp @@ -19,11 +19,11 @@ /// Check a callable type of the form `bool(const int &)`. template struct CheckFunctionTraits { static_assert( - std::is_same::result_t, bool>::value, + std::is_same_v::result_t, bool>, "expected result_t to be `bool`"); static_assert( - std::is_same::template arg_t<0>, - const int &>::value, + std::is_same_v::template arg_t<0>, + const int &>, "expected arg_t<0> to be `const int &`"); static_assert(function_traits::num_args == 1, "expected num_args to be 1"); 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(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/Analysis/CallGraphTest.cpp b/llvm/unittests/Analysis/CallGraphTest.cpp --- a/llvm/unittests/Analysis/CallGraphTest.cpp +++ b/llvm/unittests/Analysis/CallGraphTest.cpp @@ -23,11 +23,11 @@ auto X = ++I; // Should be able to iterate over all nodes of the graph. - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Node type does not match"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Node type does not match"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Node type does not match"); NodeRef N = GraphTraits::getEntryNode(G); @@ -36,9 +36,9 @@ auto F = GraphTraits::child_end(N); // Should be able to iterate over immediate successors of a node. - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Node type does not match"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Node type does not match"); } 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(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); } // end anonymous namespace diff --git a/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp b/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp --- a/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp +++ b/llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp @@ -181,16 +181,14 @@ EXPECT_EQ(crbegin(), const_reverse_iterator(cend())); // Confirm lack of implicit conversions. - static_assert(!std::is_convertible::value, + static_assert(!std::is_convertible_v, "unexpected implicit conversion"); - static_assert(!std::is_convertible::value, + static_assert(!std::is_convertible_v, + "unexpected implicit conversion"); + static_assert(!std::is_convertible_v, + "unexpected implicit conversion"); + static_assert(!std::is_convertible_v, "unexpected implicit conversion"); - static_assert( - !std::is_convertible::value, - "unexpected implicit conversion"); - static_assert( - !std::is_convertible::value, - "unexpected implicit conversion"); } } // end 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 @@ -472,7 +472,6 @@ EXPECT_THAT(BuildMI(MBB, MIMD, MCID), HasMIMetadata(MIMD)); } -static_assert(std::is_trivially_copyable::value, - "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "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 @@ -17,13 +17,12 @@ using namespace llvm; #if __has_feature(is_trivially_copyable) || (defined(__GNUC__) && __GNUC__ >= 5) -static_assert(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "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, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "trivially copyable"); #endif diff --git a/llvm/unittests/ExecutionEngine/Orc/SimplePackedSerializationTest.cpp b/llvm/unittests/ExecutionEngine/Orc/SimplePackedSerializationTest.cpp --- a/llvm/unittests/ExecutionEngine/Orc/SimplePackedSerializationTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/SimplePackedSerializationTest.cpp @@ -67,7 +67,7 @@ template static void testFixedIntegralTypeSerialization() { spsSerializationRoundTrip(0); spsSerializationRoundTrip(static_cast(1)); - if (std::is_signed::value) { + if (std::is_signed_v) { spsSerializationRoundTrip(static_cast(-1)); spsSerializationRoundTrip(std::numeric_limits::min()); } 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,11 +267,10 @@ EXPECT_TRUE(isa(B.getOrAddBlock("d")->getTerminator())); } -static_assert(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); -static_assert(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); -static_assert(std::is_trivially_copyable::value, - "trivially copyable"); -static_assert(std::is_trivially_copyable::value, +static_assert(std::is_trivially_copyable_v, "trivially copyable"); +static_assert(std::is_trivially_copyable_v, "trivially copyable"); diff --git a/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp b/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp --- a/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp +++ b/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp @@ -23,7 +23,7 @@ using DomUpdate = DominatorTree::UpdateType; static_assert( - std::is_same::value, + std::is_same_v, "Trees differing only in IsPostDom should have the same update types"); using DomSNCA = DomTreeBuilder::SemiNCAInfo; using PostDomSNCA = DomTreeBuilder::SemiNCAInfo; diff --git a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp --- a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp +++ b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp @@ -401,8 +401,8 @@ template using ExtraMockPassHandle = - std::conditional_t::value, - MockPassHandle, MockPassHandle>; + std::conditional_t, MockPassHandle, + MockPassHandle>; template class PassBuilderCallbacksTest; diff --git a/llvm/unittests/IR/ValueMapTest.cpp b/llvm/unittests/IR/ValueMapTest.cpp --- a/llvm/unittests/IR/ValueMapTest.cpp +++ b/llvm/unittests/IR/ValueMapTest.cpp @@ -115,8 +115,7 @@ template void CompileAssertHasType(VarType) { - static_assert(std::is_same::value, - "Not the same type"); + static_assert(std::is_same_v, "Not the same type"); } TYPED_TEST(ValueMapTest, Iteration) { diff --git a/llvm/unittests/Support/Casting.cpp b/llvm/unittests/Support/Casting.cpp --- a/llvm/unittests/Support/Casting.cpp +++ b/llvm/unittests/Support/Casting.cpp @@ -122,15 +122,15 @@ using namespace llvm; // Test the peculiar behavior of Use in simplify_type. -static_assert(std::is_same::SimpleType, Value *>::value, +static_assert(std::is_same_v::SimpleType, Value *>, "Use doesn't simplify correctly!"); -static_assert(std::is_same::SimpleType, Value *>::value, +static_assert(std::is_same_v::SimpleType, Value *>, "Use doesn't simplify correctly!"); // Test that a regular class behaves as expected. -static_assert(std::is_same::SimpleType, int>::value, +static_assert(std::is_same_v::SimpleType, int>, "Unexpected simplify_type result!"); -static_assert(std::is_same::SimpleType, foo *>::value, +static_assert(std::is_same_v::SimpleType, foo *>, "Unexpected simplify_type result!"); namespace { @@ -177,7 +177,7 @@ std::unique_ptr BP(B2); auto FP = cast(std::move(BP)); - static_assert(std::is_same, decltype(FP)>::value, + static_assert(std::is_same_v, decltype(FP)>, "Incorrect deduced return type!"); EXPECT_NE(FP.get(), null_foo); FP.release(); diff --git a/llvm/unittests/Support/ErrorOrTest.cpp b/llvm/unittests/Support/ErrorOrTest.cpp --- a/llvm/unittests/Support/ErrorOrTest.cpp +++ b/llvm/unittests/Support/ErrorOrTest.cpp @@ -113,27 +113,26 @@ // ErrorOr x(nullptr); // ErrorOr> y = x; // invalid conversion static_assert( - !std::is_convertible &, - ErrorOr>>::value, + !std::is_convertible_v &, + ErrorOr>>, "do not invoke explicit ctors in implicit conversion from lvalue"); // ErrorOr> y = ErrorOr(nullptr); // invalid // // conversion static_assert( - !std::is_convertible &&, - ErrorOr>>::value, + !std::is_convertible_v &&, ErrorOr>>, "do not invoke explicit ctors in implicit conversion from rvalue"); // ErrorOr x(nullptr); // ErrorOr> y; // y = x; // invalid conversion -static_assert(!std::is_assignable>&, - const ErrorOr &>::value, +static_assert(!std::is_assignable_v> &, + const ErrorOr &>, "do not invoke explicit ctors in assignment"); // ErrorOr> x; // x = ErrorOr(nullptr); // invalid conversion -static_assert(!std::is_assignable>&, - ErrorOr &&>::value, - "do not invoke explicit ctors in assignment"); +static_assert( + !std::is_assignable_v> &, ErrorOr &&>, + "do not invoke explicit ctors in assignment"); } // end anon namespace 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(std::is_trivially_copyable>::value, +static_assert(std::is_trivially_copyable_v>, "trivially copyable"); } // end namespace diff --git a/llvm/unittests/Support/ThreadLocalTest.cpp b/llvm/unittests/Support/ThreadLocalTest.cpp --- a/llvm/unittests/Support/ThreadLocalTest.cpp +++ b/llvm/unittests/Support/ThreadLocalTest.cpp @@ -25,9 +25,8 @@ TEST_F(ThreadLocalTest, Basics) { ThreadLocal x; - static_assert( - std::is_const::type>::value, - "ThreadLocal::get didn't return a pointer to const object"); + static_assert(std::is_const_v>, + "ThreadLocal::get didn't return a pointer to const object"); EXPECT_EQ(nullptr, x.get()); @@ -40,9 +39,8 @@ ThreadLocal y; - static_assert( - !std::is_const::type>::value, - "ThreadLocal::get returned a pointer to const object"); + static_assert(!std::is_const_v>, + "ThreadLocal::get returned a pointer to const object"); EXPECT_EQ(nullptr, y.get());