LLVM 24.0.0git
llvm::FoldingSetVector< T, VectorT > Class Template Reference

This template class combines a FoldingSet and a vector to provide the interface of FoldingSet but with deterministic iteration order based on the insertion order. More...

#include "llvm/ADT/FoldingSet.h"

Public Types

using iterator = pointee_iterator<typename VectorT::iterator>
using const_iterator = pointee_iterator<typename VectorT::const_iterator>

Public Member Functions

 FoldingSetVector (unsigned Log2InitSize=6)
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
void clear ()
 Remove all nodes from the folding set.
Tlookup (const FoldingSetNodeID &ID, FoldingSetInsertToken &Token)
 Look up the node specified by ID.
TFindNodeOrInsertPos (const FoldingSetNodeID &ID, void *&InsertPos)
TgetOrInsert (T *N)
 If there is an existing node exactly equal to the specified node, return it.
TGetOrInsertNode (T *N)
void insert (T *N, FoldingSetInsertToken Token)
 Insert the specified node into the folding set, knowing that it is not already in the folding set.
void InsertNode (T *N, void *InsertPos)
void insert (T *N)
 Insert the specified node into the folding set, knowing that it is not already in the folding set.
void InsertNode (T *N)
unsigned size () const
 Returns the number of nodes in the folding set.
bool empty () const
 Returns true if there are no nodes in the folding set.

Detailed Description

template<class T, class VectorT = SmallVector<T *, 8>>
class llvm::FoldingSetVector< T, VectorT >

This template class combines a FoldingSet and a vector to provide the interface of FoldingSet but with deterministic iteration order based on the insertion order.

T must be a subclass of FoldingSetNode and implement a Profile function.

Definition at line 578 of file FoldingSet.h.

Member Typedef Documentation

◆ const_iterator

template<class T, class VectorT = SmallVector<T *, 8>>
using llvm::FoldingSetVector< T, VectorT >::const_iterator = pointee_iterator<typename VectorT::const_iterator>

Definition at line 590 of file FoldingSet.h.

◆ iterator

template<class T, class VectorT = SmallVector<T *, 8>>
using llvm::FoldingSetVector< T, VectorT >::iterator = pointee_iterator<typename VectorT::iterator>

Definition at line 585 of file FoldingSet.h.

Constructor & Destructor Documentation

◆ FoldingSetVector()

template<class T, class VectorT = SmallVector<T *, 8>>
llvm::FoldingSetVector< T, VectorT >::FoldingSetVector ( unsigned Log2InitSize = 6)
inlineexplicit

Definition at line 583 of file FoldingSet.h.

Member Function Documentation

◆ begin() [1/2]

template<class T, class VectorT = SmallVector<T *, 8>>
iterator llvm::FoldingSetVector< T, VectorT >::begin ( )
inline

Definition at line 587 of file FoldingSet.h.

◆ begin() [2/2]

template<class T, class VectorT = SmallVector<T *, 8>>
const_iterator llvm::FoldingSetVector< T, VectorT >::begin ( ) const
inline

Definition at line 592 of file FoldingSet.h.

◆ clear()

template<class T, class VectorT = SmallVector<T *, 8>>
void llvm::FoldingSetVector< T, VectorT >::clear ( )
inline

Remove all nodes from the folding set.

Definition at line 596 of file FoldingSet.h.

◆ empty()

template<class T, class VectorT = SmallVector<T *, 8>>
bool llvm::FoldingSetVector< T, VectorT >::empty ( ) const
inlinenodiscard

Returns true if there are no nodes in the folding set.

Definition at line 644 of file FoldingSet.h.

◆ end() [1/2]

template<class T, class VectorT = SmallVector<T *, 8>>
iterator llvm::FoldingSetVector< T, VectorT >::end ( )
inline

Definition at line 588 of file FoldingSet.h.

◆ end() [2/2]

template<class T, class VectorT = SmallVector<T *, 8>>
const_iterator llvm::FoldingSetVector< T, VectorT >::end ( ) const
inline

Definition at line 593 of file FoldingSet.h.

◆ FindNodeOrInsertPos()

template<class T, class VectorT = SmallVector<T *, 8>>
T * llvm::FoldingSetVector< T, VectorT >::FindNodeOrInsertPos ( const FoldingSetNodeID & ID,
void *& InsertPos )
inline

Definition at line 606 of file FoldingSet.h.

References T.

◆ getOrInsert()

template<class T, class VectorT = SmallVector<T *, 8>>
T * llvm::FoldingSetVector< T, VectorT >::getOrInsert ( T * N)
inline

If there is an existing node exactly equal to the specified node, return it.

Otherwise, insert 'N' and return it instead.

Definition at line 612 of file FoldingSet.h.

References N, and T.

Referenced by GetOrInsertNode().

◆ GetOrInsertNode()

template<class T, class VectorT = SmallVector<T *, 8>>
T * llvm::FoldingSetVector< T, VectorT >::GetOrInsertNode ( T * N)
inline

Definition at line 618 of file FoldingSet.h.

References getOrInsert(), N, and T.

◆ insert() [1/2]

template<class T, class VectorT = SmallVector<T *, 8>>
void llvm::FoldingSetVector< T, VectorT >::insert ( T * N)
inline

Insert the specified node into the folding set, knowing that it is not already in the folding set.

Definition at line 634 of file FoldingSet.h.

References N, and T.

◆ insert() [2/2]

template<class T, class VectorT = SmallVector<T *, 8>>
void llvm::FoldingSetVector< T, VectorT >::insert ( T * N,
FoldingSetInsertToken Token )
inline

Insert the specified node into the folding set, knowing that it is not already in the folding set.

Token must come from lookup for an ID that N profiles identically to.

Definition at line 623 of file FoldingSet.h.

References N, and T.

Referenced by InsertNode().

◆ InsertNode() [1/2]

template<class T, class VectorT = SmallVector<T *, 8>>
void llvm::FoldingSetVector< T, VectorT >::InsertNode ( T * N)
inline

Definition at line 638 of file FoldingSet.h.

References insert(), N, and T.

◆ InsertNode() [2/2]

template<class T, class VectorT = SmallVector<T *, 8>>
void llvm::FoldingSetVector< T, VectorT >::InsertNode ( T * N,
void * InsertPos )
inline

Definition at line 627 of file FoldingSet.h.

References N, and T.

◆ lookup()

template<class T, class VectorT = SmallVector<T *, 8>>
T * llvm::FoldingSetVector< T, VectorT >::lookup ( const FoldingSetNodeID & ID,
FoldingSetInsertToken & Token )
inline

Look up the node specified by ID.

If it exists, return it and clear Token; otherwise return null and set Token for a subsequent insert.

Definition at line 603 of file FoldingSet.h.

References T.

◆ size()

template<class T, class VectorT = SmallVector<T *, 8>>
unsigned llvm::FoldingSetVector< T, VectorT >::size ( ) const
inline

Returns the number of nodes in the folding set.

Definition at line 641 of file FoldingSet.h.


The documentation for this class was generated from the following file: