[llvm-commits] [llvm] r46277 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h
Ted Kremenek
kremenek at apple.com
Wed Jan 23 11:57:39 PST 2008
Author: kremenek
Date: Wed Jan 23 13:57:33 2008
New Revision: 46277
URL: http://llvm.org/viewvc/llvm-project?rev=46277&view=rev
Log:
Added "getRoot()" to ImmutableSet.
Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).
Modified:
llvm/trunk/include/llvm/ADT/ImmutableSet.h
Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=46277&r1=46276&r2=46277&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Wed Jan 23 13:57:33 2008
@@ -862,14 +862,17 @@
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 @@
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; }
More information about the llvm-commits
mailing list