projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark ImmutableMap::remove/add() const.
[oota-llvm.git]
/
include
/
llvm
/
ADT
/
ImmutableMap.h
diff --git
a/include/llvm/ADT/ImmutableMap.h
b/include/llvm/ADT/ImmutableMap.h
index 4883c5ba0a6b0e2e56fcd3eb0601914127826aaf..f9baec213a6eae70526261b0629a90ccf4e16bc5 100644
(file)
--- a/
include/llvm/ADT/ImmutableMap.h
+++ b/
include/llvm/ADT/ImmutableMap.h
@@
-288,6
+288,13
@@
public:
Factory(F) {
if (Root) { Root->retain(); }
}
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),
ImmutableMapRef(const ImmutableMapRef &X)
: Root(X.Root),
@@
-318,12
+325,20
@@
public:
return ImmutableMapRef(0, F);
}
return ImmutableMapRef(0, F);
}
- ImmutableMapRef add(key_type_ref K, data_type_ref D) {
+ void manualRetain() {
+ if (Root) Root->retain();
+ }
+
+ void manualRelease() {
+ if (Root) Root->release();
+ }
+
+ ImmutableMapRef add(key_type_ref K, data_type_ref D) const {
TreeTy *NewT = Factory->add(Root, std::pair<key_type, data_type>(K, D));
return ImmutableMapRef(NewT, Factory);
}
TreeTy *NewT = Factory->add(Root, std::pair<key_type, data_type>(K, D));
return ImmutableMapRef(NewT, Factory);
}
- ImmutableMapRef remove(key_type_ref K) {
+ ImmutableMapRef remove(key_type_ref K)
const
{
TreeTy *NewT = Factory->remove(Root, K);
return ImmutableMapRef(NewT, Factory);
}
TreeTy *NewT = Factory->remove(Root, K);
return ImmutableMapRef(NewT, Factory);
}