[llvm] [LLVM] Add option to store Parent-pointer in ilist_node_base (PR #94224)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 09:01:56 PDT 2024


================
@@ -42,6 +45,48 @@ template <> class ilist_node_base<true> {
   ilist_node_base *getPrev() const { return PrevAndSentinel.getPointer(); }
   ilist_node_base *getNext() const { return Next; }
 
+  void setNodeBaseParent(void) {}
+  inline void getNodeBaseParent() const {}
+
+  bool isSentinel() const { return PrevAndSentinel.getInt(); }
+  bool isKnownSentinel() const { return isSentinel(); }
+  void initializeSentinel() { PrevAndSentinel.setInt(true); }
+};
+
+template <class ParentPtrTy> class ilist_node_base<false, ParentPtrTy> {
----------------
SLTozer wrote:

Unfortunately not directly, but the common base class approach could work!

https://github.com/llvm/llvm-project/pull/94224


More information about the llvm-commits mailing list