File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 18
18
#define SWIFT_BASIC_SOURCELOC_H
19
19
20
20
#include " swift/Basic/LLVM.h"
21
+ #include " llvm/ADT/DenseMapInfo.h"
21
22
#include " llvm/ADT/StringRef.h"
22
23
#include " llvm/Support/SMLoc.h"
23
24
#include < functional>
@@ -214,4 +215,31 @@ class CharSourceRange {
214
215
215
216
} // end namespace swift
216
217
218
+ namespace llvm {
219
+ template <typename T> struct DenseMapInfo ;
220
+
221
+ template <> struct DenseMapInfo <swift::SourceRange> {
222
+ static swift::SourceRange getEmptyKey () { return swift::SourceRange (); }
223
+
224
+ static swift::SourceRange getTombstoneKey () {
225
+ // Make this different from empty key. See for context:
226
+ // http://lists.llvm.org/pipermail/llvm-dev/2015-July/088744.html
227
+ return swift::SourceRange (swift::SourceLoc (
228
+ SMLoc::getFromPointer (DenseMapInfo<const char *>::getTombstoneKey ())));
229
+ }
230
+
231
+ static unsigned getHashValue (const swift::SourceRange &Val) {
232
+ return hash_combine (DenseMapInfo<const void *>::getHashValue (
233
+ Val.Start .getOpaquePointerValue ()),
234
+ DenseMapInfo<const void *>::getHashValue (
235
+ Val.End .getOpaquePointerValue ()));
236
+ }
237
+
238
+ static bool isEqual (const swift::SourceRange &LHS,
239
+ const swift::SourceRange &RHS) {
240
+ return LHS == RHS;
241
+ }
242
+ };
243
+ } // namespace llvm
244
+
217
245
#endif // SWIFT_BASIC_SOURCELOC_H
You can’t perform that action at this time.
0 commit comments