/home/arjun/llvm-project/llvm/include/llvm/ADT/StringMap.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- StringMap.h - String Hash table map interface ------------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file defines the StringMap class. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_ADT_STRINGMAP_H |
14 | | #define LLVM_ADT_STRINGMAP_H |
15 | | |
16 | | #include "llvm/ADT/StringMapEntry.h" |
17 | | #include "llvm/Support/AllocatorBase.h" |
18 | | #include "llvm/Support/PointerLikeTypeTraits.h" |
19 | | #include <initializer_list> |
20 | | #include <iterator> |
21 | | |
22 | | namespace llvm { |
23 | | |
24 | | template <typename ValueTy> class StringMapConstIterator; |
25 | | template <typename ValueTy> class StringMapIterator; |
26 | | template <typename ValueTy> class StringMapKeyIterator; |
27 | | |
28 | | /// StringMapImpl - This is the base class of StringMap that is shared among |
29 | | /// all of its instantiations. |
30 | | class StringMapImpl { |
31 | | protected: |
32 | | // Array of NumBuckets pointers to entries, null pointers are holes. |
33 | | // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed |
34 | | // by an array of the actual hash values as unsigned integers. |
35 | | StringMapEntryBase **TheTable = nullptr; |
36 | | unsigned NumBuckets = 0; |
37 | | unsigned NumItems = 0; |
38 | | unsigned NumTombstones = 0; |
39 | | unsigned ItemSize; |
40 | | |
41 | | protected: |
42 | 4 | explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {} |
43 | | StringMapImpl(StringMapImpl &&RHS) |
44 | | : TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets), |
45 | | NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones), |
46 | 0 | ItemSize(RHS.ItemSize) { |
47 | 0 | RHS.TheTable = nullptr; |
48 | 0 | RHS.NumBuckets = 0; |
49 | 0 | RHS.NumItems = 0; |
50 | 0 | RHS.NumTombstones = 0; |
51 | 0 | } |
52 | | |
53 | | StringMapImpl(unsigned InitSize, unsigned ItemSize); |
54 | | unsigned RehashTable(unsigned BucketNo = 0); |
55 | | |
56 | | /// LookupBucketFor - Look up the bucket that the specified string should end |
57 | | /// up in. If it already exists as a key in the map, the Item pointer for the |
58 | | /// specified bucket will be non-null. Otherwise, it will be null. In either |
59 | | /// case, the FullHashValue field of the bucket will be set to the hash value |
60 | | /// of the string. |
61 | | unsigned LookupBucketFor(StringRef Key); |
62 | | |
63 | | /// FindKey - Look up the bucket that contains the specified key. If it exists |
64 | | /// in the map, return the bucket number of the key. Otherwise return -1. |
65 | | /// This does not modify the map. |
66 | | int FindKey(StringRef Key) const; |
67 | | |
68 | | /// RemoveKey - Remove the specified StringMapEntry from the table, but do not |
69 | | /// delete it. This aborts if the value isn't in the table. |
70 | | void RemoveKey(StringMapEntryBase *V); |
71 | | |
72 | | /// RemoveKey - Remove the StringMapEntry for the specified key from the |
73 | | /// table, returning it. If the key is not in the table, this returns null. |
74 | | StringMapEntryBase *RemoveKey(StringRef Key); |
75 | | |
76 | | /// Allocate the table with the specified number of buckets and otherwise |
77 | | /// setup the map as empty. |
78 | | void init(unsigned Size); |
79 | | |
80 | | public: |
81 | 160 | static StringMapEntryBase *getTombstoneVal() { |
82 | 160 | uintptr_t Val = static_cast<uintptr_t>(-1); |
83 | 160 | Val <<= PointerLikeTypeTraits<StringMapEntryBase *>::NumLowBitsAvailable; |
84 | 160 | return reinterpret_cast<StringMapEntryBase *>(Val); |
85 | 160 | } |
86 | | |
87 | 0 | unsigned getNumBuckets() const { return NumBuckets; } |
88 | 0 | unsigned getNumItems() const { return NumItems; } |
89 | | |
90 | 2 | bool empty() const { return NumItems == 0; } |
91 | 0 | unsigned size() const { return NumItems; } |
92 | | |
93 | 0 | void swap(StringMapImpl &Other) { |
94 | 0 | std::swap(TheTable, Other.TheTable); |
95 | 0 | std::swap(NumBuckets, Other.NumBuckets); |
96 | 0 | std::swap(NumItems, Other.NumItems); |
97 | 0 | std::swap(NumTombstones, Other.NumTombstones); |
98 | 0 | } |
99 | | }; |
100 | | |
101 | | /// StringMap - This is an unconventional map that is specialized for handling |
102 | | /// keys that are "strings", which are basically ranges of bytes. This does some |
103 | | /// funky memory allocation and hashing things to make it extremely efficient, |
104 | | /// storing the string data *after* the value in the map. |
105 | | template <typename ValueTy, typename AllocatorTy = MallocAllocator> |
106 | | class StringMap : public StringMapImpl { |
107 | | AllocatorTy Allocator; |
108 | | |
109 | | public: |
110 | | using MapEntryTy = StringMapEntry<ValueTy>; |
111 | | |
112 | 4 | StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {} _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEEC2Ev Line | Count | Source | 112 | 4 | StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {} |
Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEEC2Ev Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEEC2Ev Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEEC2Ev Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEEC2Ev Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEEC2Ev Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEEC2Ev |
113 | | |
114 | | explicit StringMap(unsigned InitialSize) |
115 | | : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {} |
116 | | |
117 | | explicit StringMap(AllocatorTy A) |
118 | 0 | : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))), Allocator(A) { |
119 | 0 | } |
120 | | |
121 | | StringMap(unsigned InitialSize, AllocatorTy A) |
122 | | : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))), |
123 | | Allocator(A) {} |
124 | | |
125 | | StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List) |
126 | | : StringMapImpl(List.size(), static_cast<unsigned>(sizeof(MapEntryTy))) { |
127 | | for (const auto &P : List) { |
128 | | insert(P); |
129 | | } |
130 | | } |
131 | | |
132 | | StringMap(StringMap &&RHS) |
133 | | : StringMapImpl(std::move(RHS)), Allocator(std::move(RHS.Allocator)) {} |
134 | | |
135 | | StringMap(const StringMap &RHS) |
136 | | : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))), |
137 | | Allocator(RHS.Allocator) { |
138 | | if (RHS.empty()) |
139 | | return; |
140 | | |
141 | | // Allocate TheTable of the same size as RHS's TheTable, and set the |
142 | | // sentinel appropriately (and NumBuckets). |
143 | | init(RHS.NumBuckets); |
144 | | unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1), |
145 | | *RHSHashTable = (unsigned *)(RHS.TheTable + NumBuckets + 1); |
146 | | |
147 | | NumItems = RHS.NumItems; |
148 | | NumTombstones = RHS.NumTombstones; |
149 | | for (unsigned I = 0, E = NumBuckets; I != E; ++I) { |
150 | | StringMapEntryBase *Bucket = RHS.TheTable[I]; |
151 | | if (!Bucket || Bucket == getTombstoneVal()) { |
152 | | TheTable[I] = Bucket; |
153 | | continue; |
154 | | } |
155 | | |
156 | | TheTable[I] = MapEntryTy::Create( |
157 | | static_cast<MapEntryTy *>(Bucket)->getKey(), Allocator, |
158 | | static_cast<MapEntryTy *>(Bucket)->getValue()); |
159 | | HashTable[I] = RHSHashTable[I]; |
160 | | } |
161 | | |
162 | | // Note that here we've copied everything from the RHS into this object, |
163 | | // tombstones included. We could, instead, have re-probed for each key to |
164 | | // instantiate this new object without any tombstone buckets. The |
165 | | // assumption here is that items are rarely deleted from most StringMaps, |
166 | | // and so tombstones are rare, so the cost of re-probing for all inputs is |
167 | | // not worthwhile. |
168 | | } |
169 | | |
170 | | StringMap &operator=(StringMap RHS) { |
171 | | StringMapImpl::swap(RHS); |
172 | | std::swap(Allocator, RHS.Allocator); |
173 | | return *this; |
174 | | } |
175 | | |
176 | 0 | ~StringMap() { |
177 | 0 | // Delete all the elements in the map, but don't reset the elements |
178 | 0 | // to default values. This is a copy of clear(), but avoids unnecessary |
179 | 0 | // work not required in the destructor. |
180 | 0 | if (!empty()) { |
181 | 0 | for (unsigned I = 0, E = NumBuckets; I != E; ++I) { |
182 | 0 | StringMapEntryBase *Bucket = TheTable[I]; |
183 | 0 | if (Bucket && Bucket != getTombstoneVal()) { |
184 | 0 | static_cast<MapEntryTy *>(Bucket)->Destroy(Allocator); |
185 | 0 | } |
186 | 0 | } |
187 | 0 | } |
188 | 0 | free(TheTable); |
189 | 0 | } Unexecuted instantiation: _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeERNS_20BumpPtrAllocatorImplINS_15MallocAllocatorELm4096ELm4096ELm128EEEED2Ev Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEED2Ev |
190 | | |
191 | | AllocatorTy &getAllocator() { return Allocator; } |
192 | | const AllocatorTy &getAllocator() const { return Allocator; } |
193 | | |
194 | | using key_type = const char *; |
195 | | using mapped_type = ValueTy; |
196 | | using value_type = StringMapEntry<ValueTy>; |
197 | | using size_type = size_t; |
198 | | |
199 | | using const_iterator = StringMapConstIterator<ValueTy>; |
200 | | using iterator = StringMapIterator<ValueTy>; |
201 | | |
202 | 4 | iterator begin() { return iterator(TheTable, NumBuckets == 0); } _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE5beginEv Line | Count | Source | 202 | 4 | iterator begin() { return iterator(TheTable, NumBuckets == 0); } |
Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEE5beginEv Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE5beginEv |
203 | 12 | iterator end() { return iterator(TheTable + NumBuckets, true); } _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE3endEv Line | Count | Source | 203 | 12 | iterator end() { return iterator(TheTable + NumBuckets, true); } |
Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeERNS_20BumpPtrAllocatorImplINS_15MallocAllocatorELm4096ELm4096ELm128EEEE3endEv Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE3endEv |
204 | 0 | const_iterator begin() const { |
205 | 0 | return const_iterator(TheTable, NumBuckets == 0); |
206 | 0 | } Unexecuted instantiation: _ZNK4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE5beginEv Unexecuted instantiation: _ZNK4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE5beginEv |
207 | 0 | const_iterator end() const { |
208 | 0 | return const_iterator(TheTable + NumBuckets, true); |
209 | 0 | } Unexecuted instantiation: _ZNK4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZNK4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZNK4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZNK4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE3endEv Unexecuted instantiation: _ZNK4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE3endEv |
210 | | |
211 | | iterator_range<StringMapKeyIterator<ValueTy>> keys() const { |
212 | | return make_range(StringMapKeyIterator<ValueTy>(begin()), |
213 | | StringMapKeyIterator<ValueTy>(end())); |
214 | | } |
215 | | |
216 | 4 | iterator find(StringRef Key) { |
217 | 4 | int Bucket = FindKey(Key); |
218 | 4 | if (Bucket == -1) |
219 | 4 | return end(); |
220 | 0 | return iterator(TheTable + Bucket, true); |
221 | 0 | } _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE4findENS_9StringRefE Line | Count | Source | 216 | 4 | iterator find(StringRef Key) { | 217 | 4 | int Bucket = FindKey(Key); | 218 | 4 | if (Bucket == -1) | 219 | 4 | return end(); | 220 | 0 | return iterator(TheTable + Bucket, true); | 221 | 0 | } |
Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeERNS_20BumpPtrAllocatorImplINS_15MallocAllocatorELm4096ELm4096ELm128EEEE4findENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE4findENS_9StringRefE |
222 | | |
223 | 0 | const_iterator find(StringRef Key) const { |
224 | 0 | int Bucket = FindKey(Key); |
225 | 0 | if (Bucket == -1) |
226 | 0 | return end(); |
227 | 0 | return const_iterator(TheTable + Bucket, true); |
228 | 0 | } Unexecuted instantiation: _ZNK4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZNK4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZNK4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE4findENS_9StringRefE Unexecuted instantiation: _ZNK4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE4findENS_9StringRefE |
229 | | |
230 | | /// lookup - Return the entry for the specified key, or a default |
231 | | /// constructed value if no such entry exists. |
232 | 0 | ValueTy lookup(StringRef Key) const { |
233 | 0 | const_iterator it = find(Key); |
234 | 0 | if (it != end()) |
235 | 0 | return it->second; |
236 | 0 | return ValueTy(); |
237 | 0 | } |
238 | | |
239 | | /// Lookup the ValueTy for the \p Key, or create a default constructed value |
240 | | /// if the key is not in the map. |
241 | 0 | ValueTy &operator[](StringRef Key) { return try_emplace(Key).first->second; } Unexecuted instantiation: _ZN4llvm9StringMapIbNS_15MallocAllocatorEEixENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEEixENS_9StringRefE Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEEixENS_9StringRefE |
242 | | |
243 | | /// count - Return 1 if the element is in the map, 0 otherwise. |
244 | 0 | size_type count(StringRef Key) const { return find(Key) == end() ? 0 : 1; } Unexecuted instantiation: _ZNK4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE5countENS_9StringRefE Unexecuted instantiation: _ZNK4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEE5countENS_9StringRefE Unexecuted instantiation: _ZNK4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE5countENS_9StringRefE |
245 | | |
246 | | template <typename InputTy> |
247 | | size_type count(const StringMapEntry<InputTy> &MapEntry) const { |
248 | | return count(MapEntry.getKey()); |
249 | | } |
250 | | |
251 | | /// insert - Insert the specified key/value pair into the map. If the key |
252 | | /// already exists in the map, return false and ignore the request, otherwise |
253 | | /// insert it and return true. |
254 | | bool insert(MapEntryTy *KeyValue) { |
255 | | unsigned BucketNo = LookupBucketFor(KeyValue->getKey()); |
256 | | StringMapEntryBase *&Bucket = TheTable[BucketNo]; |
257 | | if (Bucket && Bucket != getTombstoneVal()) |
258 | | return false; // Already exists in map. |
259 | | |
260 | | if (Bucket == getTombstoneVal()) |
261 | | --NumTombstones; |
262 | | Bucket = KeyValue; |
263 | | ++NumItems; |
264 | | assert(NumItems + NumTombstones <= NumBuckets); |
265 | | |
266 | | RehashTable(); |
267 | | return true; |
268 | | } |
269 | | |
270 | | /// insert - Inserts the specified key/value pair into the map if the key |
271 | | /// isn't already in the map. The bool component of the returned pair is true |
272 | | /// if and only if the insertion takes place, and the iterator component of |
273 | | /// the pair points to the element with key equivalent to the key of the pair. |
274 | 40 | std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV) { |
275 | 40 | return try_emplace(KV.first, std::move(KV.second)); |
276 | 40 | } _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE6insertESt4pairINS_9StringRefES3_E Line | Count | Source | 274 | 40 | std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV) { | 275 | 40 | return try_emplace(KV.first, std::move(KV.second)); | 276 | 40 | } |
Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE6insertESt4pairINS_9StringRefES7_E Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE6insertESt4pairINS_9StringRefES2_E Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE6insertESt4pairINS_9StringRefES3_E |
277 | | |
278 | | /// Inserts an element or assigns to the current element if the key already |
279 | | /// exists. The return type is the same as try_emplace. |
280 | | template <typename V> |
281 | | std::pair<iterator, bool> insert_or_assign(StringRef Key, V &&Val) { |
282 | | auto Ret = try_emplace(Key, std::forward<V>(Val)); |
283 | | if (!Ret.second) |
284 | | Ret.first->second = std::forward<V>(Val); |
285 | | return Ret; |
286 | | } |
287 | | |
288 | | /// Emplace a new element for the specified key into the map if the key isn't |
289 | | /// already in the map. The bool component of the returned pair is true |
290 | | /// if and only if the insertion takes place, and the iterator component of |
291 | | /// the pair points to the element with key equivalent to the key of the pair. |
292 | | template <typename... ArgsTy> |
293 | 40 | std::pair<iterator, bool> try_emplace(StringRef Key, ArgsTy &&... Args) { |
294 | 40 | unsigned BucketNo = LookupBucketFor(Key); |
295 | 40 | StringMapEntryBase *&Bucket = TheTable[BucketNo]; |
296 | 40 | if (Bucket && Bucket != getTombstoneVal()) |
297 | 0 | return std::make_pair(iterator(TheTable + BucketNo, false), |
298 | 0 | false); // Already exists in map. |
299 | 40 | |
300 | 40 | if (Bucket == getTombstoneVal()) |
301 | 0 | --NumTombstones; |
302 | 40 | Bucket = MapEntryTy::Create(Key, Allocator, std::forward<ArgsTy>(Args)...); |
303 | 40 | ++NumItems; |
304 | 40 | assert(NumItems + NumTombstones <= NumBuckets); |
305 | 40 | |
306 | 40 | BucketNo = RehashTable(BucketNo); |
307 | 40 | return std::make_pair(iterator(TheTable + BucketNo, false), true); |
308 | 40 | } _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE11try_emplaceIJS3_EEESt4pairINS_17StringMapIteratorIS3_EEbENS_9StringRefEDpOT_ Line | Count | Source | 293 | 40 | std::pair<iterator, bool> try_emplace(StringRef Key, ArgsTy &&... Args) { | 294 | 40 | unsigned BucketNo = LookupBucketFor(Key); | 295 | 40 | StringMapEntryBase *&Bucket = TheTable[BucketNo]; | 296 | 40 | if (Bucket && Bucket != getTombstoneVal()) | 297 | 0 | return std::make_pair(iterator(TheTable + BucketNo, false), | 298 | 0 | false); // Already exists in map. | 299 | 40 | | 300 | 40 | if (Bucket == getTombstoneVal()) | 301 | 0 | --NumTombstones; | 302 | 40 | Bucket = MapEntryTy::Create(Key, Allocator, std::forward<ArgsTy>(Args)...); | 303 | 40 | ++NumItems; | 304 | 40 | assert(NumItems + NumTombstones <= NumBuckets); | 305 | 40 | | 306 | 40 | BucketNo = RehashTable(BucketNo); | 307 | 40 | return std::make_pair(iterator(TheTable + BucketNo, false), true); | 308 | 40 | } |
Unexecuted instantiation: _ZN4llvm9StringMapISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EENS_15MallocAllocatorEE11try_emplaceIJS7_EEESt4pairINS_17StringMapIteratorIS7_EEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEE11try_emplaceIJEEESt4pairINS_17StringMapIteratorIS1_EEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapIbNS_15MallocAllocatorEE11try_emplaceIJEEESt4pairINS_17StringMapIteratorIbEEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapIjNS_15MallocAllocatorEE11try_emplaceIJEEESt4pairINS_17StringMapIteratorIjEEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEE11try_emplaceIJEEESt4pairINS_17StringMapIteratorIS5_EEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapIN4mlir17AbstractOperationENS_15MallocAllocatorEE11try_emplaceIJS2_EEESt4pairINS_17StringMapIteratorIS2_EEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeERNS_20BumpPtrAllocatorImplINS_15MallocAllocatorELm4096ELm4096ELm128EEEE11try_emplaceIJEEESt4pairINS_17StringMapIteratorIS1_EEbENS_9StringRefEDpOT_ Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE11try_emplaceIJS3_EEESt4pairINS_17StringMapIteratorIS3_EEbENS_9StringRefEDpOT_ |
309 | | |
310 | | // clear - Empties out the StringMap |
311 | 0 | void clear() { |
312 | 0 | if (empty()) |
313 | 0 | return; |
314 | 0 | |
315 | 0 | // Zap all values, resetting the keys back to non-present (not tombstone), |
316 | 0 | // which is safe because we're removing all elements. |
317 | 0 | for (unsigned I = 0, E = NumBuckets; I != E; ++I) { |
318 | 0 | StringMapEntryBase *&Bucket = TheTable[I]; |
319 | 0 | if (Bucket && Bucket != getTombstoneVal()) { |
320 | 0 | static_cast<MapEntryTy *>(Bucket)->Destroy(Allocator); |
321 | 0 | } |
322 | 0 | Bucket = nullptr; |
323 | 0 | } |
324 | 0 |
|
325 | 0 | NumItems = 0; |
326 | 0 | NumTombstones = 0; |
327 | 0 | } Unexecuted instantiation: _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE5clearEv Unexecuted instantiation: _ZN4llvm9StringMapINS_8NoneTypeENS_15MallocAllocatorEE5clearEv Unexecuted instantiation: _ZN4llvm9StringMapINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEENS_15MallocAllocatorEE5clearEv |
328 | | |
329 | | /// remove - Remove the specified key/value pair from the map, but do not |
330 | | /// erase it. This aborts if the key is not in the map. |
331 | 0 | void remove(MapEntryTy *KeyValue) { RemoveKey(KeyValue); } Unexecuted instantiation: _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE6removeEPNS_14StringMapEntryIS3_EE Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE6removeEPNS_14StringMapEntryIS3_EE |
332 | | |
333 | 0 | void erase(iterator I) { |
334 | 0 | MapEntryTy &V = *I; |
335 | 0 | remove(&V); |
336 | 0 | V.Destroy(Allocator); |
337 | 0 | } Unexecuted instantiation: _ZN4llvm9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEE5eraseENS_17StringMapIteratorIS3_EE Unexecuted instantiation: _ZN4llvm9StringMapIPN4mlir9OperationENS_15MallocAllocatorEE5eraseENS_17StringMapIteratorIS3_EE |
338 | | |
339 | 0 | bool erase(StringRef Key) { |
340 | 0 | iterator I = find(Key); |
341 | 0 | if (I == end()) |
342 | 0 | return false; |
343 | 0 | erase(I); |
344 | 0 | return true; |
345 | 0 | } |
346 | | }; |
347 | | |
348 | | template <typename DerivedTy, typename ValueTy> |
349 | | class StringMapIterBase |
350 | | : public iterator_facade_base<DerivedTy, std::forward_iterator_tag, |
351 | | ValueTy> { |
352 | | protected: |
353 | | StringMapEntryBase **Ptr = nullptr; |
354 | | |
355 | | public: |
356 | 0 | StringMapIterBase() = default; |
357 | | |
358 | | explicit StringMapIterBase(StringMapEntryBase **Bucket, |
359 | | bool NoAdvance = false) |
360 | 56 | : Ptr(Bucket) { |
361 | 56 | if (!NoAdvance) |
362 | 42 | AdvancePastEmptyBuckets(); |
363 | 56 | } _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIPNS_2cl6OptionEEENS_14StringMapEntryIS4_EEEC2EPPNS_18StringMapEntryBaseEb Line | Count | Source | 360 | 56 | : Ptr(Bucket) { | 361 | 56 | if (!NoAdvance) | 362 | 42 | AdvancePastEmptyBuckets(); | 363 | 56 | } |
Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPNS_2cl6OptionEEEKNS_14StringMapEntryIS4_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEEKNS_14StringMapEntryIS8_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEENS_14StringMapEntryIS8_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorINS_8NoneTypeEEENS_14StringMapEntryIS2_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIbEENS_14StringMapEntryIbEEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorINS_8NoneTypeEEEKNS_14StringMapEntryIS2_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIjEENS_14StringMapEntryIjEEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEENS_14StringMapEntryIS6_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIN4mlir17AbstractOperationEEENS_14StringMapEntryIS3_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIN4mlir17AbstractOperationEEEKNS_14StringMapEntryIS3_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIPN4mlir9OperationEEENS_14StringMapEntryIS4_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPN4mlir9OperationEEEKNS_14StringMapEntryIS4_EEEC2EPPNS_18StringMapEntryBaseEb |
364 | | |
365 | | DerivedTy &operator=(const DerivedTy &Other) { |
366 | | Ptr = Other.Ptr; |
367 | | return static_cast<DerivedTy &>(*this); |
368 | | } |
369 | | |
370 | 34 | bool operator==(const DerivedTy &RHS) const { return Ptr == RHS.Ptr; } _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorIPNS_2cl6OptionEEENS_14StringMapEntryIS4_EEEeqERKS5_ Line | Count | Source | 370 | 34 | bool operator==(const DerivedTy &RHS) const { return Ptr == RHS.Ptr; } |
Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPNS_2cl6OptionEEEKNS_14StringMapEntryIS4_EEEeqERKS5_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEEKNS_14StringMapEntryIS8_EEEeqERKS9_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEENS_14StringMapEntryIS8_EEEeqERKS9_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_22StringMapConstIteratorINS_8NoneTypeEEEKNS_14StringMapEntryIS2_EEEeqERKS3_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorIjEENS_14StringMapEntryIjEEEeqERKS2_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEENS_14StringMapEntryIS6_EEEeqERKS7_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorIN4mlir17AbstractOperationEEENS_14StringMapEntryIS3_EEEeqERKS4_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_22StringMapConstIteratorIN4mlir17AbstractOperationEEEKNS_14StringMapEntryIS3_EEEeqERKS4_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorINS_8NoneTypeEEENS_14StringMapEntryIS2_EEEeqERKS3_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPN4mlir9OperationEEEKNS_14StringMapEntryIS4_EEEeqERKS5_ Unexecuted instantiation: _ZNK4llvm17StringMapIterBaseINS_17StringMapIteratorIPN4mlir9OperationEEENS_14StringMapEntryIS4_EEEeqERKS5_ |
371 | | |
372 | 26 | DerivedTy &operator++() { // Preincrement |
373 | 26 | ++Ptr; |
374 | 26 | AdvancePastEmptyBuckets(); |
375 | 26 | return static_cast<DerivedTy &>(*this); |
376 | 26 | } Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPNS_2cl6OptionEEEKNS_14StringMapEntryIS4_EEEppEv _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIPNS_2cl6OptionEEENS_14StringMapEntryIS4_EEEppEv Line | Count | Source | 372 | 26 | DerivedTy &operator++() { // Preincrement | 373 | 26 | ++Ptr; | 374 | 26 | AdvancePastEmptyBuckets(); | 375 | 26 | return static_cast<DerivedTy &>(*this); | 376 | 26 | } |
Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEEKNS_14StringMapEntryIS8_EEEppEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEENS_14StringMapEntryIS6_EEEppEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIN4mlir17AbstractOperationEEENS_14StringMapEntryIS3_EEEppEv |
377 | | |
378 | | DerivedTy operator++(int) { // Post-increment |
379 | | DerivedTy Tmp(Ptr); |
380 | | ++*this; |
381 | | return Tmp; |
382 | | } |
383 | | |
384 | | private: |
385 | 68 | void AdvancePastEmptyBuckets() { |
386 | 106 | while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal()) |
387 | 38 | ++Ptr; |
388 | 68 | } _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIPNS_2cl6OptionEEENS_14StringMapEntryIS4_EEE23AdvancePastEmptyBucketsEv Line | Count | Source | 385 | 68 | void AdvancePastEmptyBuckets() { | 386 | 106 | while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal()) | 387 | 38 | ++Ptr; | 388 | 68 | } |
Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPNS_2cl6OptionEEEKNS_14StringMapEntryIS4_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEEKNS_14StringMapEntryIS8_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS5_EEEENS_14StringMapEntryIS8_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorINS_8NoneTypeEEENS_14StringMapEntryIS2_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIbEENS_14StringMapEntryIbEEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorINS_8NoneTypeEEEKNS_14StringMapEntryIS2_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIjEENS_14StringMapEntryIjEEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEENS_14StringMapEntryIS6_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIN4mlir17AbstractOperationEEENS_14StringMapEntryIS3_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIN4mlir17AbstractOperationEEEKNS_14StringMapEntryIS3_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_17StringMapIteratorIPN4mlir9OperationEEENS_14StringMapEntryIS4_EEE23AdvancePastEmptyBucketsEv Unexecuted instantiation: _ZN4llvm17StringMapIterBaseINS_22StringMapConstIteratorIPN4mlir9OperationEEEKNS_14StringMapEntryIS4_EEE23AdvancePastEmptyBucketsEv |
389 | | }; |
390 | | |
391 | | template <typename ValueTy> |
392 | | class StringMapConstIterator |
393 | | : public StringMapIterBase<StringMapConstIterator<ValueTy>, |
394 | | const StringMapEntry<ValueTy>> { |
395 | | using base = StringMapIterBase<StringMapConstIterator<ValueTy>, |
396 | | const StringMapEntry<ValueTy>>; |
397 | | |
398 | | public: |
399 | 0 | StringMapConstIterator() = default; |
400 | | explicit StringMapConstIterator(StringMapEntryBase **Bucket, |
401 | | bool NoAdvance = false) |
402 | 0 | : base(Bucket, NoAdvance) {} Unexecuted instantiation: _ZN4llvm22StringMapConstIteratorIPNS_2cl6OptionEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm22StringMapConstIteratorINS_8NoneTypeEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm22StringMapConstIteratorIN4mlir17AbstractOperationEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm22StringMapConstIteratorIPN4mlir9OperationEEC2EPPNS_18StringMapEntryBaseEb |
403 | | |
404 | 0 | const StringMapEntry<ValueTy> &operator*() const { |
405 | 0 | return *static_cast<const StringMapEntry<ValueTy> *>(*this->Ptr); |
406 | 0 | } Unexecuted instantiation: _ZNK4llvm22StringMapConstIteratorIPNS_2cl6OptionEEdeEv Unexecuted instantiation: _ZNK4llvm22StringMapConstIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EEEdeEv Unexecuted instantiation: _ZNK4llvm22StringMapConstIteratorIPN4mlir9OperationEEdeEv |
407 | | }; |
408 | | |
409 | | template <typename ValueTy> |
410 | | class StringMapIterator : public StringMapIterBase<StringMapIterator<ValueTy>, |
411 | | StringMapEntry<ValueTy>> { |
412 | | using base = |
413 | | StringMapIterBase<StringMapIterator<ValueTy>, StringMapEntry<ValueTy>>; |
414 | | |
415 | | public: |
416 | | StringMapIterator() = default; |
417 | | explicit StringMapIterator(StringMapEntryBase **Bucket, |
418 | | bool NoAdvance = false) |
419 | 56 | : base(Bucket, NoAdvance) {} _ZN4llvm17StringMapIteratorIPNS_2cl6OptionEEC2EPPNS_18StringMapEntryBaseEb Line | Count | Source | 419 | 56 | : base(Bucket, NoAdvance) {} |
Unexecuted instantiation: _ZN4llvm17StringMapIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorINS_8NoneTypeEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorIbEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorIjEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorIN4mlir17AbstractOperationEEC2EPPNS_18StringMapEntryBaseEb Unexecuted instantiation: _ZN4llvm17StringMapIteratorIPN4mlir9OperationEEC2EPPNS_18StringMapEntryBaseEb |
420 | | |
421 | 26 | StringMapEntry<ValueTy> &operator*() const { |
422 | 26 | return *static_cast<StringMapEntry<ValueTy> *>(*this->Ptr); |
423 | 26 | } _ZNK4llvm17StringMapIteratorIPNS_2cl6OptionEEdeEv Line | Count | Source | 421 | 26 | StringMapEntry<ValueTy> &operator*() const { | 422 | 26 | return *static_cast<StringMapEntry<ValueTy> *>(*this->Ptr); | 423 | 26 | } |
Unexecuted instantiation: _ZNK4llvm17StringMapIteratorISt10unique_ptrINS_3vfs6detail12InMemoryNodeESt14default_deleteIS4_EEEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorIbEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorIjEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorINS_11SmallVectorIN4mlir6detail12ExpectedDiagELj2EEEEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorIN4mlir17AbstractOperationEEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorINS_8NoneTypeEEdeEv Unexecuted instantiation: _ZNK4llvm17StringMapIteratorIPN4mlir9OperationEEdeEv |
424 | | |
425 | | operator StringMapConstIterator<ValueTy>() const { |
426 | | return StringMapConstIterator<ValueTy>(this->Ptr, true); |
427 | | } |
428 | | }; |
429 | | |
430 | | template <typename ValueTy> |
431 | | class StringMapKeyIterator |
432 | | : public iterator_adaptor_base<StringMapKeyIterator<ValueTy>, |
433 | | StringMapConstIterator<ValueTy>, |
434 | | std::forward_iterator_tag, StringRef> { |
435 | | using base = iterator_adaptor_base<StringMapKeyIterator<ValueTy>, |
436 | | StringMapConstIterator<ValueTy>, |
437 | | std::forward_iterator_tag, StringRef>; |
438 | | |
439 | | public: |
440 | | StringMapKeyIterator() = default; |
441 | | explicit StringMapKeyIterator(StringMapConstIterator<ValueTy> Iter) |
442 | | : base(std::move(Iter)) {} |
443 | | |
444 | | StringRef &operator*() { |
445 | | Key = this->wrapped()->getKey(); |
446 | | return Key; |
447 | | } |
448 | | |
449 | | private: |
450 | | StringRef Key; |
451 | | }; |
452 | | |
453 | | } // end namespace llvm |
454 | | |
455 | | #endif // LLVM_ADT_STRINGMAP_H |