15 #ifndef LLVM_ADT_ILIST_NODE_H
16 #define LLVM_ADT_ILIST_NODE_H
23 namespace ilist_detail {
27 template<
typename NodeTy>
30 template <
class OptionsT,
bool IsReverse,
bool IsConst>
class ilist_iterator;
42 typedef typename OptionsT::value_type value_type;
43 typedef typename OptionsT::node_base_type node_base_type;
44 typedef typename OptionsT::list_base_type list_base_type;
46 friend typename OptionsT::list_base_type;
91 using node_base_type::isKnownSentinel;
98 static_assert(OptionsT::is_sentinel_tracking_explicit,
99 "Use ilist_sentinel_tracking<true> to enable isSentinel()");
100 return node_base_type::isSentinel();
145 template <
class T,
class... Options>
148 typename ilist_detail::compute_node_options<T, Options...>::type> {
150 "Unrecognized node option!");
153 namespace ilist_detail {
162 template <
class OptionsT>
166 template <
class OptionsT>
171 template <
class OptionsT>
173 return static_cast<typename OptionsT::pointer
>(
N);
175 template <
class OptionsT>
176 static typename OptionsT::const_pointer
178 return static_cast<typename OptionsT::const_pointer
>(
N);
181 template <
class OptionsT>
185 template <
class OptionsT>
189 template <
class OptionsT>
194 template <
class OptionsT>
208 return NodeAccess::getNodePtr<OptionsT>(
N);
211 return NodeAccess::getNodePtr<OptionsT>(
N);
214 return NodeAccess::getValuePtr<OptionsT>(
N);
217 return NodeAccess::getValuePtr<OptionsT>(
N);
222 template <
class OptionsT>
223 class ilist_sentinel :
public ilist_node_impl<OptionsT> {
226 this->initializeSentinel();
235 bool empty()
const {
return this == this->getPrev(); }
242 template <
typename NodeTy,
typename ParentTy,
class... Options>
253 const ParentTy *getNodeParent()
const {
254 return static_cast<const NodeTy *
>(
this)->
getParent();
265 getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)
nullptr));
266 return List.getPrevNode(*static_cast<NodeTy *>(
this));
278 getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)
nullptr));
279 return List.getNextNode(*static_cast<NodeTy *>(
this));
static const ilist_node_impl< OptionsT > * getNext(const ilist_node_impl< OptionsT > &N)
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
ilist_iterator< OptionsT, true, false > reverse_self_iterator
static const ilist_node_impl< OptionsT > * getNodePtr(typename OptionsT::const_pointer N)
const_reverse_self_iterator getReverseIterator() const
static node_type * getNodePtr(pointer N)
static const node_type * getNodePtr(const_pointer N)
const NodeTy * getPrevNode() const
Get the previous node, or nullptr for the list head.
static pointer getValuePtr(node_type *N)
Implementation for an ilist node.
OptionsT::pointer pointer
bool isSentinel() const
Check whether this is the sentinel node.
static const_pointer getValuePtr(const node_type *N)
Function Alias Analysis false
const_self_iterator getIterator() const
const NodeTy * getNextNode() const
Get the next node, or nullptr for the list tail.
static ilist_node_impl< OptionsT > * getNodePtr(typename OptionsT::pointer N)
static ilist_node_impl< OptionsT > * getPrev(ilist_node_impl< OptionsT > &N)
An ilist node that can access its parent list.
ilist_iterator< OptionsT, false, false > self_iterator
OptionsT::const_pointer const_pointer
self_iterator getIterator()
static const ilist_node_impl< OptionsT > * getPrev(const ilist_node_impl< OptionsT > &N)
An access class for ilist_node private API.
static OptionsT::pointer getValuePtr(ilist_node_impl< OptionsT > *N)
Iterator for intrusive lists based on ilist_node.
ilist_iterator< OptionsT, true, true > const_reverse_self_iterator
ilist_node_impl()=default
Check whether options are valid.
static OptionsT::const_pointer getValuePtr(const ilist_node_impl< OptionsT > *N)
ilist_iterator< OptionsT, false, true > const_self_iterator
ilist_node_with_parent()=default
reverse_self_iterator getReverseIterator()
static const Function * getParent(const Value *V)
ilist_node_impl< OptionsT > node_type
static ilist_node_impl< OptionsT > * getNext(ilist_node_impl< OptionsT > &N)