[PATCH] D47496: [ADT] Annotate immutable data structure methods with LLVM_NODISCARD.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 31 10:39:02 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333672: [ADT] Annotate immutable list/set/map update methods with LLVM_NODISCARD. (authored by dergachev, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47496?vs=148985&id=149316#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47496
Files:
llvm/trunk/include/llvm/ADT/ImmutableList.h
llvm/trunk/include/llvm/ADT/ImmutableMap.h
llvm/trunk/include/llvm/ADT/ImmutableSet.h
Index: llvm/trunk/include/llvm/ADT/ImmutableList.h
===================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableList.h
+++ llvm/trunk/include/llvm/ADT/ImmutableList.h
@@ -166,7 +166,7 @@
if (ownsAllocator()) delete &getAllocator();
}
- ImmutableList<T> concat(const T& Head, ImmutableList<T> Tail) {
+ LLVM_NODISCARD ImmutableList<T> concat(const T &Head, ImmutableList<T> Tail) {
// Profile the new list to see if it already exists in our cache.
FoldingSetNodeID ID;
void* InsertPos;
@@ -188,7 +188,7 @@
return L;
}
- ImmutableList<T> add(const T& D, ImmutableList<T> L) {
+ LLVM_NODISCARD ImmutableList<T> add(const T& D, ImmutableList<T> L) {
return concat(D, L);
}
Index: llvm/trunk/include/llvm/ADT/ImmutableSet.h
===================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h
@@ -1017,7 +1017,7 @@
/// of this operation is logarithmic in the size of the original set.
/// The memory allocated to represent the set is released when the
/// factory object that created the set is destroyed.
- ImmutableSet add(ImmutableSet Old, value_type_ref V) {
+ LLVM_NODISCARD ImmutableSet add(ImmutableSet Old, value_type_ref V) {
TreeTy *NewT = F.add(Old.Root, V);
return ImmutableSet(Canonicalize ? F.getCanonicalTree(NewT) : NewT);
}
@@ -1029,7 +1029,7 @@
/// of this operation is logarithmic in the size of the original set.
/// The memory allocated to represent the set is released when the
/// factory object that created the set is destroyed.
- ImmutableSet remove(ImmutableSet Old, value_type_ref V) {
+ LLVM_NODISCARD ImmutableSet remove(ImmutableSet Old, value_type_ref V) {
TreeTy *NewT = F.remove(Old.Root, V);
return ImmutableSet(Canonicalize ? F.getCanonicalTree(NewT) : NewT);
}
Index: llvm/trunk/include/llvm/ADT/ImmutableMap.h
===================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableMap.h
+++ llvm/trunk/include/llvm/ADT/ImmutableMap.h
@@ -114,12 +114,13 @@
ImmutableMap getEmptyMap() { return ImmutableMap(F.getEmptyTree()); }
- ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D) {
+ LLVM_NODISCARD ImmutableMap add(ImmutableMap Old, key_type_ref K,
+ data_type_ref D) {
TreeTy *T = F.add(Old.Root, std::pair<key_type,data_type>(K,D));
return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T);
}
- ImmutableMap remove(ImmutableMap Old, key_type_ref K) {
+ LLVM_NODISCARD ImmutableMap remove(ImmutableMap Old, key_type_ref K) {
TreeTy *T = F.remove(Old.Root,K);
return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47496.149316.patch
Type: text/x-patch
Size: 2888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/7f280173/attachment.bin>
More information about the llvm-commits
mailing list