fix a comment bug Reid noticed
[oota-llvm.git] / include / llvm / ADT / FoldingSet.h
index eb361e9ed2493d5d46ed1f4de43da232e7cea106..e6ded76f260d2e404a74b5ac19075a096af9249b 100644 (file)
@@ -16,7 +16,9 @@
 #ifndef LLVM_ADT_FOLDINGSET_H
 #define LLVM_ADT_FOLDINGSET_H
 
+#include "llvm/Support/DataTypes.h"
 #include "llvm/ADT/SmallVector.h"
+#include <string>
 
 namespace llvm {
 
@@ -112,13 +114,13 @@ private:
   ///
   unsigned NumBuckets;
   
-  /// NumNodes - Number of nodes in the folding set.  Growth occurs when NumNodes
+  /// NumNodes - Number of nodes in the folding set. Growth occurs when NumNodes
   /// is greater than twice the number of buckets.
   unsigned NumNodes;
   
 public:
-  FoldingSetImpl();
-  ~FoldingSetImpl();
+  FoldingSetImpl(unsigned Log2InitSize = 6);
+  virtual ~FoldingSetImpl();
   
   // Forward declaration.
   class Node;
@@ -215,20 +217,25 @@ protected:
 typedef FoldingSetImpl::Node FoldingSetNode;
 typedef FoldingSetImpl::NodeID FoldingSetNodeID;
 
-//===--------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
 /// FoldingSet - This template class is used to instantiate a specialized
 /// implementation of the folding set to the node class T.  T must be a 
 /// subclass of FoldingSetNode and implement a Profile function.
 ///
 template<class T> class FoldingSet : public FoldingSetImpl {
 private:
-  /// GetNodeProfile - Each instantiatation of the FoldingSet 
+  /// GetNodeProfile - Each instantiatation of the FoldingSet needs to provide a
+  /// way to convert nodes into a unique specifier.
   virtual void GetNodeProfile(NodeID &ID, Node *N) const {
     T *TN = static_cast<T *>(N);
     TN->Profile(ID);
   }
   
 public:
+  FoldingSet(unsigned Log2InitSize = 6)
+  : FoldingSetImpl(Log2InitSize)
+  {}
+
   /// GetOrInsertNode - If there is an existing simple Node exactly
   /// equal to the specified node, return it.  Otherwise, insert 'N' and
   /// return it instead.
@@ -240,12 +247,11 @@ public:
   /// return it.  If not, return the insertion token that will make insertion
   /// faster.
   T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) {
-    return static_cast<T *>(FoldingSetImpl::FindNodeOrInsertPos(ID,
-                                                                InsertPos));
+    return static_cast<T *>(FoldingSetImpl::FindNodeOrInsertPos(ID, InsertPos));
   }
 };
 
-}; // End of namespace llvm.
+} // End of namespace llvm.
 
 
 #endif