aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-08 21:05:59 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-08 21:05:59 +0000
commitdb8be03ae4e6965fa8bf94c512d53860f804255c (patch)
tree8420b95e81c5f1c5a5a2704c635d55519dd8b14c
parent7c9e0878c4d88fdc881e002dfb25d59835a8b0aa (diff)
downloadexternal_llvm-db8be03ae4e6965fa8bf94c512d53860f804255c.zip
external_llvm-db8be03ae4e6965fa8bf94c512d53860f804255c.tar.gz
external_llvm-db8be03ae4e6965fa8bf94c512d53860f804255c.tar.bz2
Added "getRoot()" to ImmutableMap.
Made the ctor for ImmutableMap to construct a map from an AVL tree public. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45756 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/ImmutableMap.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h
index ac4f165..24aef7c 100644
--- a/include/llvm/ADT/ImmutableMap.h
+++ b/include/llvm/ADT/ImmutableMap.h
@@ -52,20 +52,24 @@ struct ImutKeyValueInfo {
template <typename KeyT, typename ValT,
typename ValInfo = ImutKeyValueInfo<KeyT,ValT> >
class ImmutableMap {
+public:
typedef typename ValInfo::value_type value_type;
typedef typename ValInfo::value_type_ref value_type_ref;
typedef typename ValInfo::key_type key_type;
typedef typename ValInfo::key_type_ref key_type_ref;
typedef typename ValInfo::data_type data_type;
typedef typename ValInfo::data_type_ref data_type_ref;
+ typedef ImutAVLTree<ValInfo> TreeTy;
-private:
- typedef ImutAVLTree<ValInfo> TreeTy;
+private:
TreeTy* Root;
-
- ImmutableMap(TreeTy* R) : Root(R) {}
-
+
public:
+ /// Constructs a map from a pointer to a tree root. In general one
+ /// should use a Factory object to create maps instead of directly
+ /// invoking the constructor, but there are cases where make this
+ /// constructor public is useful.
+ explicit ImmutableMap(TreeTy* R) : Root(R) {}
class Factory {
typename TreeTy::Factory F;
@@ -112,6 +116,8 @@ public:
return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root;
}
+ TreeTy* getRoot() const { return Root; }
+
bool isEmpty() const { return !Root; }
//===--------------------------------------------------===//