LLVM 24.0.0git
llvm::FoldingSetImpl< T, Trait > Class Template Reference

An implementation detail that lets us share code between FoldingSet and ContextualFoldingSet. More...

#include "llvm/ADT/FoldingSet.h"

Inheritance diagram for llvm::FoldingSetImpl< T, Trait >:
[legend]

Public Types

using iterator = FoldingSetIterator<T>
using const_iterator = FoldingSetIterator<const T>

Public Member Functions

 FoldingSetImpl (unsigned Log2InitSize=6)
template<typename C, typename = std::enable_if_t<std::is_constructible_v< typename Trait::ContextStorage, C>>>
 FoldingSetImpl (C &&Context, unsigned Log2InitSize=6)
 FoldingSetImpl (FoldingSetImpl &&Arg)=default
FoldingSetImploperator= (FoldingSetImpl &&RHS)=default
 ~FoldingSetImpl ()=default
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
bool erase (T *N)
 Remove a node from the folding set, returning true if one was removed or false if the node was not in the folding set.
LLVM_ATTRIBUTE_NOINLINE TgetOrInsert (T *N)
 If there is an existing node exactly equal to the specified node, return it.
Tlookup (const FoldingSetNodeID &ID, FoldingSetInsertToken &Token)
 Look up the node specified by ID.
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 insert (T *N)
 Insert the specified node into the folding set, knowing that it is not already in the folding set.
Public Member Functions inherited from llvm::FoldingSetBase
LLVM_ABI void clear ()
 Remove all nodes from the folding set.
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.
LLVM_ABI void reserve (unsigned N)
 Grow the number of buckets so that we can hold at least N nodes before rebucketing.
Public Member Functions inherited from llvm::DebugEpochBase
void incrementEpoch ()

Additional Inherited Members

Protected Member Functions inherited from llvm::FoldingSetBase
LLVM_ABI FoldingSetBase (unsigned Log2InitSize)
LLVM_ABI FoldingSetBase (FoldingSetBase &&Arg)
LLVM_ABI FoldingSetBaseoperator= (FoldingSetBase &&RHS)
LLVM_ABI ~FoldingSetBase ()
LLVM_ABI bool erase (FoldingSetNode *N)
 Remove a node from the folding set, returning true if one was removed or false if the node was not in the folding set.
template<typename MatchFn>
FoldingSetNodeprobe (uint32_t Hash, FoldingSetInsertToken &Token, MatchFn IsMatch)
 Walk the probe chain for Hash, offering each node whose cached hash matches to IsMatch.
LLVM_ABI void insert (FoldingSetNode *N, FoldingSetInsertToken Token)
 Insert the specified node into the folding set, knowing that it is not already in the folding set.
Static Protected Member Functions inherited from llvm::FoldingSetBase
static FoldingSetInsertToken makeInsertToken (uint32_t Hash)
 Wrap Hash, which must not be NotAHash, as the token insert takes.
Protected Attributes inherited from llvm::FoldingSetBase
FoldingSetNode ** Buckets = nullptr
 Array of node pointers; a null entry marks an empty slot.
unsigned NumBuckets = 0
 Length of the Buckets array. Always a power of 2.
unsigned NumNodes = 0
 Number of nodes in the folding set.

Detailed Description

template<class T, class Trait = FoldingSetTrait<T>>
class llvm::FoldingSetImpl< T, Trait >

An implementation detail that lets us share code between FoldingSet and ContextualFoldingSet.

Definition at line 453 of file FoldingSet.h.

Member Typedef Documentation

◆ const_iterator

template<class T, class Trait = FoldingSetTrait<T>>
using llvm::FoldingSetImpl< T, Trait >::const_iterator = FoldingSetIterator<const T>

Definition at line 490 of file FoldingSet.h.

◆ iterator

template<class T, class Trait = FoldingSetTrait<T>>
using llvm::FoldingSetImpl< T, Trait >::iterator = FoldingSetIterator<T>

Definition at line 483 of file FoldingSet.h.

Constructor & Destructor Documentation

◆ FoldingSetImpl() [1/3]

template<class T, class Trait = FoldingSetTrait<T>>
llvm::FoldingSetImpl< T, Trait >::FoldingSetImpl ( unsigned Log2InitSize = 6)
inlineexplicit

Definition at line 469 of file FoldingSet.h.

◆ FoldingSetImpl() [2/3]

template<class T, class Trait = FoldingSetTrait<T>>
template<typename C, typename = std::enable_if_t<std::is_constructible_v< typename Trait::ContextStorage, C>>>
llvm::FoldingSetImpl< T, Trait >::FoldingSetImpl ( C && Context,
unsigned Log2InitSize = 6 )
inlineexplicit

Definition at line 474 of file FoldingSet.h.

◆ FoldingSetImpl() [3/3]

template<class T, class Trait = FoldingSetTrait<T>>
llvm::FoldingSetImpl< T, Trait >::FoldingSetImpl ( FoldingSetImpl< T, Trait > && Arg)
default

◆ ~FoldingSetImpl()

template<class T, class Trait = FoldingSetTrait<T>>
llvm::FoldingSetImpl< T, Trait >::~FoldingSetImpl ( )
default

Member Function Documentation

◆ begin() [1/2]

template<class T, class Trait = FoldingSetTrait<T>>
iterator llvm::FoldingSetImpl< T, Trait >::begin ( )
inline

Definition at line 485 of file FoldingSet.h.

◆ begin() [2/2]

template<class T, class Trait = FoldingSetTrait<T>>
const_iterator llvm::FoldingSetImpl< T, Trait >::begin ( ) const
inline

Definition at line 492 of file FoldingSet.h.

◆ end() [1/2]

template<class T, class Trait = FoldingSetTrait<T>>
iterator llvm::FoldingSetImpl< T, Trait >::end ( )
inline

Definition at line 486 of file FoldingSet.h.

◆ end() [2/2]

template<class T, class Trait = FoldingSetTrait<T>>
const_iterator llvm::FoldingSetImpl< T, Trait >::end ( ) const
inline

Definition at line 495 of file FoldingSet.h.

◆ erase()

template<class T, class Trait = FoldingSetTrait<T>>
bool llvm::FoldingSetImpl< T, Trait >::erase ( T * N)
inline

Remove a node from the folding set, returning true if one was removed or false if the node was not in the folding set.

Definition at line 501 of file FoldingSet.h.

◆ getOrInsert()

template<class T, class Trait = FoldingSetTrait<T>>
LLVM_ATTRIBUTE_NOINLINE T * llvm::FoldingSetImpl< T, Trait >::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.

Out of line so that callers do not inherit the ID's inline storage; some of them recurse.

Definition at line 508 of file FoldingSet.h.

Referenced by llvm::FoldingSetImpl< T, Trait >< ListTy >::insert().

◆ insert() [1/2]

template<class T, class Trait = FoldingSetTrait<T>>
void llvm::FoldingSetImpl< T, Trait >::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 541 of file FoldingSet.h.

◆ insert() [2/2]

template<class T, class Trait = FoldingSetTrait<T>>
void llvm::FoldingSetImpl< T, Trait >::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 529 of file FoldingSet.h.

Referenced by llvm::RecordRecTy::get().

◆ lookup()

template<class T, class Trait = FoldingSetTrait<T>>
T * llvm::FoldingSetImpl< T, Trait >::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 520 of file FoldingSet.h.

Referenced by llvm::RecordRecTy::get(), and llvm::FoldingSetImpl< T, Trait >< ListTy >::getOrInsert().

◆ operator=()

template<class T, class Trait = FoldingSetTrait<T>>
FoldingSetImpl & llvm::FoldingSetImpl< T, Trait >::operator= ( FoldingSetImpl< T, Trait > && RHS)
default

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