DenseMap with a small inline bucket buffer to avoid heap allocation.

Synopsis

Declared in <llvm/ADT/DenseMap.h>

template<
    typename KeyT,
    typename ValueT,
    unsigned int InlineBuckets = 4,
    typename KeyInfoT = DenseMapInfo<KeyT>,
    typename BucketT = /* implementation-defined */>
class SmallDenseMap
    : public DenseMapBase<SmallDenseMap<KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT>, KeyT, ValueT, KeyInfoT, BucketT>

Base Classes

Name

Description

DenseMapBase<SmallDenseMap<KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT>, KeyT, ValueT, KeyInfoT, BucketT>

CRTP base implementing a dense probed hash map from keys to values.

Types

Name

Description

HandleBase

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

Type Aliases

Name

Description

const_iterator

Const iterator over map entries.

iterator

Iterator over map entries.

key_type

The map's key type.

mapped_type

The map's mapped value type.

size_type

Unsigned type used for map sizes and capacities.

value_type

The map's value type (key/value bucket pair).

Member Functions

Name

Description

SmallDenseMap [constructor]

Constructors

~SmallDenseMap [destructor]

Destroy all entries and deallocate bucket storage.

operator=

Assignment operators

at

Return the entry for the specified key, or abort if no such entry exists.

begin

begin overloads

clear

Remove all entries from the map, possibly shrinking storage if capacity is large relative to size.

contains

Return true if the specified key is in the map, false otherwise.

count

Return 1 if the specified key is in the map, 0 otherwise.

emplace_or_assign

Emplace Key with value constructed from Args, or assign a new value if the key exists.

empty

Return true if the map contains no entries.

end

end overloads

erase

erase overloads

eraseFromFilledBucket

Erase the entry at TheBucket without invoking a move callback.

find

find overloads

find_as

find_as overloads

getMemorySize

Return the approximate size in bytes of the map's storage.

getPointerIntoBucketsArray

Return an opaque pointer into the buckets array.

incrementEpoch

No‐op when ABI‐breaking checks are disabled.

insert

insert overloads

insert_as

Insert using an alternate, possibly cheaper, lookup key type.

insert_or_assign

Insert Key with value Val, or assign Val if the key exists.

insert_range

Inserts range of 'std::pair<KeyT, ValueT>' values into the map.

isPointerIntoBucketsArray

Return true if the specified pointer points somewhere into the DenseMap's array of buckets (i.e. either to a key or value in the DenseMap).

keys

keys overloads

lookup

Return the entry for the specified key, or a default constructed value if no such entry exists.

lookup_or

Return the entry with the specified key, or Default.

operator[]

Return the value for Key, inserting a default‐constructed value if absent.

remove_if

Remove entries that match the given predicate.

reserve

Grow the densemap so that it can contain at least NumEntries items before resizing again.

shrink_and_clear

Remove all entries and shrink bucket storage to fit the empty map.

size

Return the number of entries in the map.

swap

Swap the contents of this map with RHS.

try_emplace

Insert a key and construct its value in‐place if the key is absent. If the key is already present, the stored value is left unchanged.

values

values overloads

Protected Types

Name

Description

ExactBucketCount

Tag type selecting constructors that take an exact bucket count rather than a reserve‐for‐N‐entries hint.

Rep

Hot‐path snapshot of bucket storage fields.

Protected Member Functions

Name

Description

copyFrom

Replace this map's contents with a copy of other (requires other != this).

destroyAll

Destroy all live key/value pairs in the bucket array.

getMinBucketToReserveForEntries

Returns the number of buckets to allocate to ensure that the DenseMap can accommodate NumEntries without need to grow().

initEmpty

Reset entry count to zero and clear the used‐bit array for all buckets.

initWithExactBucketCount

Initialize bucket storage with exactly NewNumBuckets buckets.

moveFrom

Move key/value pairs from Other into this empty map; requires Other != this.

Friends

Name

Description

llvm::DenseMapBase

CRTP base implementing a dense probed hash map from keys to values.

Non-Member Functions

Name

Description

operator!=

Compare two DenseMaps of SymbolsMapKey to Symbol pointers for inequality.

operator!=

Inequality comparison for DenseMap.

operator==

Compare two DenseMaps of SymbolsMapKey to Symbol pointers for equality.

operator==

Equality comparison for DenseMap.

Created with MrDocs