[llvm] r216044 - Fix an off by 1 bug that prevented SmallPtrSet from using all of its 'small' capacity. Then fix the early return in the move constructor that prevented 'small' moves from clearing the NumElements in the moved from object. The directed test missed this because it was always testing large moves due to the off by 1 bug.

Craig Topper craig.topper at gmail.com
Sat Aug 30 18:07:47 PDT 2014


Was trying to circle back to write this test. But I realize that the
objects in the set are pointers so moving or copying them is trivial.


On Tue, Aug 19, 2014 at 11:27 PM, Chandler Carruth <chandlerc at google.com>
wrote:

>
> On Tue, Aug 19, 2014 at 10:19 PM, Craig Topper <craig.topper at gmail.com>
> wrote:
>
>> Not sure how. How do can we verify if its still 'small' or not from
>> outside?
>
>
> I thought we had a way to test for that, mostly to check things in tests?
>
> You can still verify it without that though: put objects in it that track
> when they are moved (or copied) and move a set. When the set is small, it
> will move the elements. When it is large, it will just re-point the
> pointers.
>
>
>> With the off by 1 fixed, the test did catch the bad move constructor.
>
>
> Yea, it was just the off-by-one issue i was wondering about.
>
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140830/57e0ecd6/attachment.html>


More information about the llvm-commits mailing list