add support for hashing nodehandles.
authorChris Lattner <sabre@nondot.org>
Tue, 15 Mar 2005 17:51:51 +0000 (17:51 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 15 Mar 2005 17:51:51 +0000 (17:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20620 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DataStructure/DSSupport.h

index 08bb3ee17e5da3f645b6496e1280a62e3c110fae..52461f88448d25c1a9568f36a78846b0a2a57965 100644 (file)
@@ -146,6 +146,15 @@ namespace std {
   inline void swap<llvm::DSNodeHandle>(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); }
 }
 
+namespace HASH_NAMESPACE {
+  // Provide a hash function for arbitrary pointers...
+  template <> struct hash<llvm::DSNodeHandle> {
+    inline size_t operator()(const llvm::DSNodeHandle &Val) const {
+      return hash<void*>()(Val.getNode()) ^ Val.getOffset();
+    }
+  };
+}
+
 namespace llvm {
 
 //===----------------------------------------------------------------------===//