[llvm-commits] [patch] Add a MapVector class

Chandler Carruth chandlerc at google.com
Wed Aug 29 14:22:28 PDT 2012


Cool! A couple of thoughts that might simplify this...

Do we need to provide a full map-iterator? My suspicion is that all of the
places where we use this, iterating the dense map directly is a bug. I'd
like to see if we colud get away with the MapVector essentially only
exposing the vector iteration, but exposing an operator[] which accepts a
key type, and a find which accepts a key type (the find still returning a
vector iterator).

Also, could we specialize the DenseMapInfo to make -1 and -2 (in unsigned)
be the empty and tombstone values (resp.)? That should remove the need for
the values in the map being 1-based. It would be nice to be able to
directly forward to the vector for a lot of this.


On Wed, Aug 29, 2012 at 12:43 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> The attached patch adds a MapVector class to ADT. It behaves mostly
> like a DenseMap (including the iteration order), but provides a
> getValues method that can be used to iterate the values in a
> deterministic order.
>
> This will be used to fix a non deterministic output order in clang
> when two virtual functions are marked used because we output a vtable.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120829/04b583f6/attachment.html>


More information about the llvm-commits mailing list