Added "getRoot()" to ImmutableSet.
authorTed Kremenek <kremenek@apple.com>
Wed, 23 Jan 2008 19:57:33 +0000 (19:57 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 23 Jan 2008 19:57:33 +0000 (19:57 +0000)
Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46277 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ImmutableSet.h

index 9f08b038fc69ea77585d8eedb1784a0deec69b62..527ef20064271d8673a809cedb55fdf6320527c2 100644 (file)
@@ -862,14 +862,17 @@ class ImmutableSet {
 public:
   typedef typename ValInfo::value_type      value_type;
   typedef typename ValInfo::value_type_ref  value_type_ref;
-  
-private:  
   typedef ImutAVLTree<ValInfo> TreeTy;
+
+private:  
   TreeTy* Root;
-  
-  ImmutableSet(TreeTy* R) : Root(R) {}
-  
+
 public:
+  /// Constructs a set from a pointer to a tree root.  In general one
+  /// should use a Factory object to create sets instead of directly
+  /// invoking the constructor, but there are cases where make this
+  /// constructor public is useful.
+  explicit ImmutableSet(TreeTy* R) : Root(R) {}
   
   class Factory {
     typename TreeTy::Factory F;
@@ -924,6 +927,8 @@ public:
     return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root;
   }
   
+  TreeTy* getRoot() const { return Root; }
+  
   /// isEmpty - Return true if the set contains no elements.
   bool isEmpty() const { return !Root; }