[PATCH] D106367: [ADT] Correct the wrong header comment of ImmutableSet::add_internal
Gabor Marton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 20 08:19:09 PDT 2021
martong created this revision.
martong added reviewers: vsavchenko, NoQ, steakhal.
Herald added subscribers: dexonsmith, gamesh411, Szelethus, dkrupp, rnkovacs.
martong requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
ImmutableSet and ImmutableMap add function boils down to `add_internal`. The
related comments for that function are however misleading. We do return a new
tree if an element with an existing key (and possibly with a different value)
is added. We do not return the old tree with the old key-value pair.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106367
Files:
llvm/include/llvm/ADT/ImmutableSet.h
Index: llvm/include/llvm/ADT/ImmutableSet.h
===================================================================
--- llvm/include/llvm/ADT/ImmutableSet.h
+++ llvm/include/llvm/ADT/ImmutableSet.h
@@ -539,7 +539,7 @@
/// add_internal - Creates a new tree that includes the specified
/// data and the data from the original tree. If the original tree
- /// already contained the data item, the original tree is returned.
+ /// already contained the data item, a new tree is returned.
TreeTy* add_internal(value_type_ref V, TreeTy* T) {
if (isEmpty(T))
return createNode(T, V, T);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106367.360146.patch
Type: text/x-patch
Size: 605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/f89ae514/attachment.bin>
More information about the llvm-commits
mailing list