Go to the documentation of this file.
14 #ifndef LLVM_ADT_ILIST_NODE_H
15 #define LLVM_ADT_ILIST_NODE_H
22 namespace ilist_detail {
28 template <
class OptionsT,
bool IsReverse,
bool IsConst>
class ilist_iterator;
40 using value_type =
typename OptionsT::value_type;
41 using node_base_type =
typename OptionsT::node_base_type;
42 using list_base_type =
typename OptionsT::list_base_type;
44 friend typename OptionsT::list_base_type;
93 using node_base_type::isKnownSentinel;
100 static_assert(OptionsT::is_sentinel_tracking_explicit,
101 "Use ilist_sentinel_tracking<true> to enable isSentinel()");
147 template <
class T,
class... Options>
150 typename ilist_detail::compute_node_options<T, Options...>::type> {
152 "Unrecognized node option!");
155 namespace ilist_detail {
165 template <
class OptionsT>
170 template <
class OptionsT>
176 template <
class OptionsT>
178 return static_cast<typename OptionsT::pointer
>(
N);
181 template <
class OptionsT>
182 static typename OptionsT::const_pointer
184 return static_cast<typename OptionsT::const_pointer
>(
N);
187 template <
class OptionsT>
192 template <
class OptionsT>
197 template <
class OptionsT>
203 template <
class OptionsT>
217 return NodeAccess::getNodePtr<OptionsT>(
N);
221 return NodeAccess::getNodePtr<OptionsT>(
N);
225 return NodeAccess::getValuePtr<OptionsT>(
N);
229 return NodeAccess::getValuePtr<OptionsT>(
N);
235 template <
class OptionsT>
236 class ilist_sentinel :
public ilist_node_impl<OptionsT> {
239 this->initializeSentinel();
248 bool empty()
const {
return this == this->getPrev(); }
255 template <
typename NodeTy,
typename ParentTy,
class... Options>
266 const ParentTy *getNodeParent()
const {
267 return static_cast<const NodeTy *
>(
this)->
getParent();
278 getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)
nullptr));
279 return List.getPrevNode(*
static_cast<NodeTy *
>(
this));
292 getNodeParent()->*(ParentTy::getSublistAccess((NodeTy *)
nullptr));
293 return List.getNextNode(*
static_cast<NodeTy *
>(
this));
305 #endif // LLVM_ADT_ILIST_NODE_H
ilist_iterator< OptionsT, false, false > self_iterator
const NodeTy * getPrevNode() const
Get the previous node, or nullptr for the list head.
static ilist_node_impl< OptionsT > * getNext(ilist_node_impl< OptionsT > &N)
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
An ilist node that can access its parent list.
static ilist_node_impl< OptionsT > * getNodePtr(typename OptionsT::pointer N)
typename ilist_detail::compute_node_options< llvm::PredicateBase, Options... >::type ::pointer pointer
reverse_self_iterator getReverseIterator()
ilist_iterator< OptionsT, true, false > reverse_self_iterator
static node_type * getNodePtr(pointer N)
static bool isSentinel(const DWARFDebugNames::AttributeEncoding &AE)
static pointer getValuePtr(node_type *N)
typename ilist_detail::compute_node_options< llvm::PredicateBase, Options... >::type ::const_pointer const_pointer
static const_pointer getValuePtr(const node_type *N)
bool isSentinel() const
Check whether this is the sentinel node.
ilist_iterator< OptionsT, false, true > const_self_iterator
ilist_node_with_parent()=default
An access class for ilist_node private API.
ilist_node_impl()=default
static const ilist_node_impl< OptionsT > * getNext(const ilist_node_impl< OptionsT > &N)
Implementation for an ilist node.
const_self_iterator getIterator() const
static const Function * getParent(const Value *V)
self_iterator getIterator()
static const ilist_node_impl< OptionsT > * getNodePtr(typename OptionsT::const_pointer N)
ilist_iterator< OptionsT, true, true > const_reverse_self_iterator
static const node_type * getNodePtr(const_pointer N)
Iterator for intrusive lists based on ilist_node.
static OptionsT::const_pointer getValuePtr(const ilist_node_impl< OptionsT > *N)
static OptionsT::pointer getValuePtr(ilist_node_impl< OptionsT > *N)
static ilist_node_impl< OptionsT > * getPrev(ilist_node_impl< OptionsT > &N)
Check whether options are valid.
const_reverse_self_iterator getReverseIterator() const
static const ilist_node_impl< OptionsT > * getPrev(const ilist_node_impl< OptionsT > &N)
const NodeTy * getNextNode() const
Get the next node, or nullptr for the list tail.