@@ -292,6 +292,19 @@ class AnyRequest final : public AnyRequestBase<AnyRequest> {
292
292
293
293
const void *getRawStorage () const { return storage; }
294
294
295
+ // / Whether this wrapper is storing the same underlying request as an
296
+ // / \c ActiveRequest.
297
+ bool isStorageEqual (const ActiveRequest &other) const {
298
+ // If either wrapper isn't storing anything, just return false.
299
+ if (!hasStorage () || !other.hasStorage ())
300
+ return false ;
301
+
302
+ if (getVTable ()->typeID != other.getVTable ()->typeID )
303
+ return false ;
304
+
305
+ return getVTable ()->isEqual (getRawStorage (), other.getRawStorage ());
306
+ }
307
+
295
308
public:
296
309
AnyRequest (const AnyRequest &other) : AnyRequestBase(other) {
297
310
if (hasStorage ()) {
@@ -382,6 +395,8 @@ namespace llvm {
382
395
template <>
383
396
struct DenseMapInfo <swift::AnyRequest> {
384
397
using AnyRequest = swift::AnyRequest;
398
+ using ActiveRequest = swift::ActiveRequest;
399
+
385
400
static inline AnyRequest getEmptyKey () {
386
401
return AnyRequest (AnyRequest::StorageKind::Empty);
387
402
}
@@ -396,6 +411,9 @@ namespace llvm {
396
411
return AnyRequest::hashForHolder (swift::TypeID<Request>::value,
397
412
hash_value (request));
398
413
}
414
+ static unsigned getHashValue (const ActiveRequest &request) {
415
+ return hash_value (request);
416
+ }
399
417
static bool isEqual (const AnyRequest &lhs, const AnyRequest &rhs) {
400
418
return lhs == rhs;
401
419
}
@@ -407,6 +425,9 @@ namespace llvm {
407
425
auto *rhsRequest = rhs.getAs <Request>();
408
426
return rhsRequest && lhs == *rhsRequest;
409
427
}
428
+ static bool isEqual (const ActiveRequest &lhs, const AnyRequest &rhs) {
429
+ return rhs.isStorageEqual (lhs);
430
+ }
410
431
};
411
432
412
433
} // end namespace llvm
0 commit comments