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 concat(const T& Head, ImmutableList Tail) { + LLVM_NODISCARD ImmutableList concat(const T &Head, ImmutableList 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 add(const T& D, ImmutableList L) { + LLVM_NODISCARD ImmutableList add(const T& D, ImmutableList L) { return concat(D, L); } 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(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); } 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); }