aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-23 19:57:33 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-23 19:57:33 +0000
commitc43fa6c1eedab4f4004617b7e1fe772f97acac82 (patch)
treeebf7294adbe7e3dc8a70b203a6736e6a7e892353 /include
parentae4f62fc7e13cbe25f853fe56e551a2a1ca39cc0 (diff)
downloadexternal_llvm-c43fa6c1eedab4f4004617b7e1fe772f97acac82.zip
external_llvm-c43fa6c1eedab4f4004617b7e1fe772f97acac82.tar.gz
external_llvm-c43fa6c1eedab4f4004617b7e1fe772f97acac82.tar.bz2
Added "getRoot()" to ImmutableSet.
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/ImmutableSet.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h
index 9f08b03..527ef20 100644
--- a/include/llvm/ADT/ImmutableSet.h
+++ b/include/llvm/ADT/ImmutableSet.h
@@ -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; }