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

Synopsis

Declared in <llvm/ADT/FoldingSet.h>

template<
    class T,
    class Trait = FoldingSetTrait<T>>
class FoldingSetImpl
    : public FoldingSetBase
    , public Trait::ContextStorage

Base Classes

Name

Description

FoldingSetBase

Non‐templated base class for FoldingSet and ContextualFoldingSet, holding the memory management and probing that does not depend on the node type.

Trait::ContextStorage

Types

Name

Description

HandleBase

Empty stub of HandleBase used when ABI‐breaking checks are disabled.

Node

This class is used to maintain node state in a folding set.

Type Aliases

Name

Description

const_iterator

Const iterator over the non‐null nodes stored in the folding set.

iterator

Iterator over the non‐null nodes stored in the folding set.

Member Functions

Name

Description

FoldingSetImpl [constructor]

Move‐construct a folding set from Arg, leaving it in a valid empty state.

FoldingSetImpl [constructor]

Construct an empty folding set with 2ˆLog2InitSize buckets.

FoldingSetImpl [constructor]

Construct a contextual folding set with fixed Context and 2ˆLog2InitSize buckets.

~FoldingSetImpl [destructor]

Destroy the folding set; nodes are not deleted by this destructor.

operator=

Move‐assign a folding set, leaving RHS in a valid empty state.

FindNodeOrInsertPos

Look up the node specified by ID. If it exists, return it. If not, return the insertion token that will make insertion faster.

GetOrInsertNode

If there is an existing node exactly equal to the specified node, return it. Otherwise, insert 'N' and return it instead.

InsertNode

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

InsertNode

Insert the specified node into the folding set, knowing that it is not already in the folding set. InsertPos must be obtained from FindNodeOrInsertPos.

RemoveNode

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

begin

Return an iterator to the first non‐null node in the folding set.

begin

Return a const iterator to the first non‐null node in the folding set.

clear

Remove all nodes from the folding set.

empty

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

end

Return an iterator past the last node in the folding set.

end

Return a const iterator past the last node in the folding set.

incrementEpoch

No‐op when ABI‐breaking checks are disabled.

reserve

Grow the number of buckets so that we can hold at least N nodes before rebucketing. May allocate more space than requested.

size

Returns the number of nodes in the folding set.

Protected Types

Name

Description

FoldingSetInfo

Derived‐class hooks that compute folding properties for a node.

Protected Member Functions

Name

Description

operator=

Move‐assign a folding set, leaving RHS in a valid empty state.

FindNodeOrInsertPos

Look up the node specified by ID. If it exists, return it. If not, return the insertion token that will make insertion faster.

GetOrInsertNode

If there is an existing node exactly equal to the node N, return it. Otherwise, insert N and return it instead.

InsertNode

Insert N into the set at InsertPos; N must not already be present.

RemoveNode

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

Protected Data Members

Name

Description

Buckets

Array of node pointers; a null entry marks an empty slot.

NumBuckets

Length of the Buckets array. Always a power of 2.

NumNodes

Number of nodes in the folding set.

Created with MrDocs