[llvm] bab6cfe - Remove code only needed to detect a pre-4.0 API break.

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 13:05:38 PDT 2023


Author: Owen Anderson
Date: 2023-04-25T13:05:31-07:00
New Revision: bab6cfede92830bb38d08282c62144df79b13600

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

LOG: Remove code only needed to detect a pre-4.0 API break.

Updated with build fix for unit tests

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D149125

Added: 
    

Modified: 
    llvm/include/llvm/ADT/ilist.h
    llvm/unittests/ADT/IListTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/ilist.h b/llvm/include/llvm/ADT/ilist.h
index 9913b7cccbdda..aed19ccbff7f2 100644
--- a/llvm/include/llvm/ADT/ilist.h
+++ b/llvm/include/llvm/ADT/ilist.h
@@ -92,63 +92,6 @@ struct ilist_traits : public ilist_node_traits<NodeTy> {};
 /// Const traits should never be instantiated.
 template <typename Ty> struct ilist_traits<const Ty> {};
 
-namespace ilist_detail {
-
-template <class T> 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 <class TraitsT, class NodeT> struct HasGetNext {
-  typedef char Yes[1];
-  typedef char No[2];
-  template <size_t N> struct SFINAE {};
-
-  template <class U>
-  static Yes &test(U *I, decltype(I->getNext(&make<NodeT>())) * = nullptr);
-  template <class> static No &test(...);
-
-public:
-  static const bool value = sizeof(test<TraitsT>(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 <class TraitsT> struct HasCreateSentinel {
-  typedef char Yes[1];
-  typedef char No[2];
-
-  template <class U>
-  static Yes &test(U *I, decltype(I->createSentinel()) * = nullptr);
-  template <class> static No &test(...);
-
-public:
-  static const bool value = sizeof(test<TraitsT>(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 <class TraitsT, class NodeT> struct HasCreateNode {
-  typedef char Yes[1];
-  typedef char No[2];
-  template <size_t N> struct SFINAE {};
-
-  template <class U>
-  static Yes &test(U *I, decltype(I->createNode(make<NodeT>())) * = 0);
-  template <class> static No &test(...);
-
-public:
-  static const bool value = sizeof(test<TraitsT>(nullptr)) == sizeof(Yes);
-};
-
-template <class TraitsT, class NodeT> struct HasObsoleteCustomization {
-  static const bool value = HasGetNext<TraitsT, NodeT>::value ||
-                            HasCreateSentinel<TraitsT>::value ||
-                            HasCreateNode<TraitsT, NodeT>::value;
-};
-
-} // end namespace ilist_detail
-
 //===----------------------------------------------------------------------===//
 //
 /// A wrapper around an intrusive list with callbacks and non-intrusive
@@ -182,13 +125,6 @@ class iplist_impl : public TraitsT, IntrusiveListT {
       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<TraitsT, value_type>::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
index 18f6c41a64807..2fdc8e12d0fa8 100644
--- a/llvm/unittests/ADT/IListTest.cpp
+++ b/llvm/unittests/ADT/IListTest.cpp
@@ -158,42 +158,6 @@ TEST(IListTest, UnsafeClear) {
   EXPECT_EQ(6, List.back().Value);
 }
 
-struct Empty {};
-TEST(IListTest, HasObsoleteCustomizationTrait) {
-  // Negative test for HasObsoleteCustomization.
-  static_assert(!ilist_detail::HasObsoleteCustomization<Empty, Node>::value,
-                "Empty has no customizations");
-}
-
-struct GetNext {
-  Node *getNext(Node *);
-};
-TEST(IListTest, HasGetNextTrait) {
-  static_assert(ilist_detail::HasGetNext<GetNext, Node>::value,
-                "GetNext has a getNext(Node*)");
-  static_assert(ilist_detail::HasObsoleteCustomization<GetNext, Node>::value,
-                "Empty should be obsolete because of getNext()");
-
-  // Negative test for HasGetNext.
-  static_assert(!ilist_detail::HasGetNext<Empty, Node>::value,
-                "Empty does not have a getNext(Node*)");
-}
-
-struct CreateSentinel {
-  Node *createSentinel();
-};
-TEST(IListTest, HasCreateSentinelTrait) {
-  static_assert(ilist_detail::HasCreateSentinel<CreateSentinel>::value,
-                "CreateSentinel has a getNext(Node*)");
-  static_assert(
-      ilist_detail::HasObsoleteCustomization<CreateSentinel, Node>::value,
-      "Empty should be obsolete because of createSentinel()");
-
-  // Negative test for HasCreateSentinel.
-  static_assert(!ilist_detail::HasCreateSentinel<Empty>::value,
-                "Empty does not have a createSentinel()");
-}
-
 struct NodeWithCallback : ilist_node<NodeWithCallback> {
   int Value = 0;
   bool IsInList = false;


        


More information about the llvm-commits mailing list