StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

Synopsis

Declared in <llvm/ADT/StringMap.h>

template<
    typename ValueTy,
    typename AllocatorTy = MallocAllocator>
class StringMap
    : public StringMapImpl

Base Classes

Name

Description

StringMapImpl

StringMapImpl ‐ This is the base class of StringMap that is shared among all of its instantiations.

Types

Name

Description

HandleBase

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

Type Aliases

Name

Description

MapEntryTy

Entry type storing a key and mapped value together.

const_iterator

Const iterator over map entries.

iterator

Mutable iterator over map entries.

key_type

Key type exposed for STL compatibility (internally a C string pointer).

mapped_type

Mapped value type.

size_type

Unsigned type used for sizes.

value_type

Entry type combining key and value.

Member Functions

Name

Description

StringMap [constructor]

Constructors

~StringMap [destructor]

Destroy all entries and free the table.

operator=

Copy‐assign by swapping with a copy of RHS.

at

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.

contains

contains ‐ Return true if the element is in the map, false otherwise.

count

count overloads

empty

Return true if the map contains no entries.

end

end overloads

erase

erase overloads

find

find overloads

getNumBuckets

Return the number of allocated hash buckets.

getNumItems

Return the number of live entries.

incrementEpoch

No‐op when ABI‐breaking checks are disabled.

insert

insert overloads

insert_or_assign

Inserts an element or assigns to the current element if the key already exists. The return type is the same as try_emplace.

keys

Return a range that yields each key as a StringRef.

lookup

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

operator[]

Lookup the ValueTy for the Key, or create a default constructed value if the key is not in the map.

remove

remove ‐ Remove the specified key/value pair from the map, but do not erase it. This aborts if the key is not in the map.

remove_if

Remove every entry for which Pred returns true.

size

Return the number of live entries.

swap

Exchange the contents of this map with Other.

try_emplace

Emplace a value for Key if the key is not already present.

try_emplace_with_hash

Emplace a value for Key using a precomputed hash if absent.

operator==

equal ‐ check whether both of the containers are equal.

operator!=

Return true if the maps differ in keys or values.

Static Member Functions

Name

Description

hash

Return the hash value used for Key.

Using Declarations

Protected Member Functions

Name

Description

FindKey

FindKey overloads

LookupBucketFor

LookupBucketFor overloads

RehashTable

Grow and rehash the table; return the new bucket for BucketNo.

RemoveKey

RemoveKey overloads

buckets

Return a range over the raw bucket pointer array.

init

Allocate the table with the specified number of buckets and otherwise setup the map as empty.

removeBucket

Remove the entry pointer at the given (live) bucket without destroying the entry, and close the hole via Algorithm R backward shifting.

Protected Data Members

Name

Description

ItemSize

Size in bytes of each StringMapEntry specialization.

NumBuckets

Number of hash buckets currently allocated.

NumItems

Number of live key/value entries in the map.

TheTable

Hash table of entry pointers; null slots are empty probe holes.

Specializations

Name

Description

StringMap<unsigned int>

StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

StringMap<array<unsigned int, 5>>

StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

StringMap<basic_string<char>>

StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

StringMap<unique_ptr<LibraryInfo>>

StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

StringMap<Value*>

StringMap ‐ This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.

Non-Member Functions

Name

Description

sys::getHostCPUFeatures

getHostCPUFeatures ‐ Get the LLVM names for the host CPU features. The particular format of the names are target dependent, and suitable for passing as ‐mattr to the target which matches the host.

Derived Classes

Name

Description

StringSet

StringSet ‐ A wrapper for StringMap that provides set‐like functionality.

Created with MrDocs