[PATCH] ADT: Add SmallPtrSet::reset()

David Blaikie dblaikie at gmail.com
Thu Mar 19 16:52:09 PDT 2015


Totally plausible. Optional/debatable comments:

1) is it worth supporting the more idiomatic clear+shrink_to_fit to be
clear of the semantics? ('reset' seems vague) It looks like it's sort of
halfway there already, with shrink_and_clear. Could just be generalized a
bit more to be part of the solution to this use case
2) I would perhaps consider testing via looking at the address of an
element added after calling reset, rather than using isSmall, but I realize
that's totally subjective (& reactive - perhaps if I wrote it, I would've
written it as you have)

On Thu, Mar 19, 2015 at 4:43 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> 0001 adds `SmallPtrSet::reset()`, which returns `SmallPtrSet` to small
> mode after completely freeing its heap memory.  To facilitate testing,
> I changed `isSmall()` to a public accessor.
>
> Thoughts?
>
> (0002 is the reason I was looking at this.)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150319/453918af/attachment.html>


More information about the llvm-commits mailing list