Added FoldingSet profiling support to ImmutableSet.
authorTed Kremenek <kremenek@apple.com>
Tue, 5 Feb 2008 18:50:25 +0000 (18:50 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 5 Feb 2008 18:50:25 +0000 (18:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46757 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ImmutableSet.h

index c436a2c72b0a3d5a4e37a667713df604fc7c61f6..c339e3d4f96b62a6fcfed0e0bd18d30d476d7e51 100644 (file)
@@ -1011,12 +1011,25 @@ public:
   iterator begin() const { return iterator(Root); }
   iterator end() const { return iterator(); }  
   
+  //===--------------------------------------------------===//    
+  // Utility methods.
+  //===--------------------------------------------------===//  
+  
+  inline unsigned getHeight() const { return Root ? Root->getHeight() : 0; }
+  
+  static inline void Profile(FoldingSetNodeID& ID, const ImmutableSet& S) {
+    ID.AddPointer(S.Root);
+  }
+  
+  inline void Profile(FoldingSetNodeID& ID) const {
+    return Profile(ID,*this);
+  }
+  
   //===--------------------------------------------------===//    
   // For testing.
   //===--------------------------------------------------===//  
   
   void verify() const { if (Root) Root->verify(); }
-  unsigned getHeight() const { return Root ? Root->getHeight() : 0; }
 };
 
 } // end namespace llvm