diff --git a/llvm/include/llvm/ADT/ilist.h b/llvm/include/llvm/ADT/ilist.h --- a/llvm/include/llvm/ADT/ilist.h +++ b/llvm/include/llvm/ADT/ilist.h @@ -92,63 +92,6 @@ /// Const traits should never be instantiated. template struct ilist_traits {}; -namespace ilist_detail { - -template T &make(); - -/// Type trait to check for a traits class that has a getNext member (as a -/// canary for any of the ilist_nextprev_traits API). -template struct HasGetNext { - typedef char Yes[1]; - typedef char No[2]; - template struct SFINAE {}; - - template - static Yes &test(U *I, decltype(I->getNext(&make())) * = nullptr); - template static No &test(...); - -public: - static const bool value = sizeof(test(nullptr)) == sizeof(Yes); -}; - -/// Type trait to check for a traits class that has a createSentinel member (as -/// a canary for any of the ilist_sentinel_traits API). -template struct HasCreateSentinel { - typedef char Yes[1]; - typedef char No[2]; - - template - static Yes &test(U *I, decltype(I->createSentinel()) * = nullptr); - template static No &test(...); - -public: - static const bool value = sizeof(test(nullptr)) == sizeof(Yes); -}; - -/// Type trait to check for a traits class that has a createNode member. -/// Allocation should be managed in a wrapper class, instead of in -/// ilist_traits. -template struct HasCreateNode { - typedef char Yes[1]; - typedef char No[2]; - template struct SFINAE {}; - - template - static Yes &test(U *I, decltype(I->createNode(make())) * = 0); - template static No &test(...); - -public: - static const bool value = sizeof(test(nullptr)) == sizeof(Yes); -}; - -template struct HasObsoleteCustomization { - static const bool value = HasGetNext::value || - HasCreateSentinel::value || - HasCreateNode::value; -}; - -} // end namespace ilist_detail - //===----------------------------------------------------------------------===// // /// A wrapper around an intrusive list with callbacks and non-intrusive @@ -182,13 +125,6 @@ typename base_list_type::const_reverse_iterator const_reverse_iterator; private: - // TODO: Drop this assertion and the transitive type traits anytime after - // v4.0 is branched (i.e,. keep them for one release to help out-of-tree code - // update). - static_assert( - !ilist_detail::HasObsoleteCustomization::value, - "ilist customization points have changed!"); - static bool op_less(const_reference L, const_reference R) { return L < R; } static bool op_equal(const_reference L, const_reference R) { return L == R; } diff --git a/llvm/unittests/ADT/IListTest.cpp b/llvm/unittests/ADT/IListTest.cpp --- a/llvm/unittests/ADT/IListTest.cpp +++ b/llvm/unittests/ADT/IListTest.cpp @@ -158,42 +158,6 @@ EXPECT_EQ(6, List.back().Value); } -struct Empty {}; -TEST(IListTest, HasObsoleteCustomizationTrait) { - // Negative test for HasObsoleteCustomization. - static_assert(!ilist_detail::HasObsoleteCustomization::value, - "Empty has no customizations"); -} - -struct GetNext { - Node *getNext(Node *); -}; -TEST(IListTest, HasGetNextTrait) { - static_assert(ilist_detail::HasGetNext::value, - "GetNext has a getNext(Node*)"); - static_assert(ilist_detail::HasObsoleteCustomization::value, - "Empty should be obsolete because of getNext()"); - - // Negative test for HasGetNext. - static_assert(!ilist_detail::HasGetNext::value, - "Empty does not have a getNext(Node*)"); -} - -struct CreateSentinel { - Node *createSentinel(); -}; -TEST(IListTest, HasCreateSentinelTrait) { - static_assert(ilist_detail::HasCreateSentinel::value, - "CreateSentinel has a getNext(Node*)"); - static_assert( - ilist_detail::HasObsoleteCustomization::value, - "Empty should be obsolete because of createSentinel()"); - - // Negative test for HasCreateSentinel. - static_assert(!ilist_detail::HasCreateSentinel::value, - "Empty does not have a createSentinel()"); -} - struct NodeWithCallback : ilist_node { int Value = 0; bool IsInList = false;