|
13 | 13 | #ifndef LLVM_ADT_DENSEMAPINFO_H
|
14 | 14 | #define LLVM_ADT_DENSEMAPINFO_H
|
15 | 15 |
|
16 |
| -#include "llvm/ADT/ArrayRef.h" |
17 | 16 | #include "llvm/ADT/Hashing.h"
|
18 |
| -#include "llvm/ADT/StringRef.h" |
19 | 17 | #include <cassert>
|
20 | 18 | #include <cstddef>
|
21 | 19 | #include <cstdint>
|
@@ -284,62 +282,6 @@ template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
|
284 | 282 | }
|
285 | 283 | };
|
286 | 284 |
|
287 |
| -// Provide DenseMapInfo for StringRefs. |
288 |
| -template <> struct DenseMapInfo<StringRef> { |
289 |
| - static inline StringRef getEmptyKey() { |
290 |
| - return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)), |
291 |
| - 0); |
292 |
| - } |
293 |
| - |
294 |
| - static inline StringRef getTombstoneKey() { |
295 |
| - return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)), |
296 |
| - 0); |
297 |
| - } |
298 |
| - |
299 |
| - static unsigned getHashValue(StringRef Val) { |
300 |
| - assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); |
301 |
| - assert(Val.data() != getTombstoneKey().data() && |
302 |
| - "Cannot hash the tombstone key!"); |
303 |
| - return (unsigned)(hash_value(Val)); |
304 |
| - } |
305 |
| - |
306 |
| - static bool isEqual(StringRef LHS, StringRef RHS) { |
307 |
| - if (RHS.data() == getEmptyKey().data()) |
308 |
| - return LHS.data() == getEmptyKey().data(); |
309 |
| - if (RHS.data() == getTombstoneKey().data()) |
310 |
| - return LHS.data() == getTombstoneKey().data(); |
311 |
| - return LHS == RHS; |
312 |
| - } |
313 |
| -}; |
314 |
| - |
315 |
| -// Provide DenseMapInfo for ArrayRefs. |
316 |
| -template <typename T> struct DenseMapInfo<ArrayRef<T>> { |
317 |
| - static inline ArrayRef<T> getEmptyKey() { |
318 |
| - return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(0)), |
319 |
| - size_t(0)); |
320 |
| - } |
321 |
| - |
322 |
| - static inline ArrayRef<T> getTombstoneKey() { |
323 |
| - return ArrayRef<T>(reinterpret_cast<const T *>(~static_cast<uintptr_t>(1)), |
324 |
| - size_t(0)); |
325 |
| - } |
326 |
| - |
327 |
| - static unsigned getHashValue(ArrayRef<T> Val) { |
328 |
| - assert(Val.data() != getEmptyKey().data() && "Cannot hash the empty key!"); |
329 |
| - assert(Val.data() != getTombstoneKey().data() && |
330 |
| - "Cannot hash the tombstone key!"); |
331 |
| - return (unsigned)(hash_value(Val)); |
332 |
| - } |
333 |
| - |
334 |
| - static bool isEqual(ArrayRef<T> LHS, ArrayRef<T> RHS) { |
335 |
| - if (RHS.data() == getEmptyKey().data()) |
336 |
| - return LHS.data() == getEmptyKey().data(); |
337 |
| - if (RHS.data() == getTombstoneKey().data()) |
338 |
| - return LHS.data() == getTombstoneKey().data(); |
339 |
| - return LHS == RHS; |
340 |
| - } |
341 |
| -}; |
342 |
| - |
343 | 285 | template <> struct DenseMapInfo<hash_code> {
|
344 | 286 | static inline hash_code getEmptyKey() { return hash_code(-1); }
|
345 | 287 | static inline hash_code getTombstoneKey() { return hash_code(-2); }
|
|
0 commit comments