[llvm-commits] [llvm] r169572 - /llvm/trunk/include/llvm/ADT/ImmutableMap.h
Ted Kremenek
kremenek at apple.com
Thu Dec 6 18:03:01 PST 2012
Author: kremenek
Date: Thu Dec 6 20:03:00 2012
New Revision: 169572
URL: http://llvm.org/viewvc/llvm-project?rev=169572&view=rev
Log:
Add manualRetain() and manualRelease() to ImmutableMapRef, and add a new constructor.
Modified:
llvm/trunk/include/llvm/ADT/ImmutableMap.h
Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=169572&r1=169571&r2=169572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Thu Dec 6 20:03:00 2012
@@ -288,6 +288,13 @@
Factory(F) {
if (Root) { Root->retain(); }
}
+
+ explicit ImmutableMapRef(const ImmutableMap<KeyT, ValT> &X,
+ typename ImmutableMap<KeyT, ValT>::Factory &F)
+ : Root(X.getRootWithoutRetain()),
+ Factory(F.getTreeFactory()) {
+ if (Root) { Root->retain(); }
+ }
ImmutableMapRef(const ImmutableMapRef &X)
: Root(X.Root),
@@ -318,6 +325,14 @@
return ImmutableMapRef(0, F);
}
+ void manualRetain() {
+ if (Root) Root->retain();
+ }
+
+ void manualRelease() {
+ if (Root) Root->release();
+ }
+
ImmutableMapRef add(key_type_ref K, data_type_ref D) {
TreeTy *NewT = Factory->add(Root, std::pair<key_type, data_type>(K, D));
return ImmutableMapRef(NewT, Factory);
More information about the llvm-commits
mailing list