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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Aug 30 19:45:20 PDT 2012


On 29 August 2012 17:22, Chandler Carruth <chandlerc at google.com> wrote:
> 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).

It looks like FinalOverriderCollector::Collect requires this. It needs
to walk all the key,values recursively computed for the base classes.

> 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.

DenseMapInfo only lets me select the key, not values. The value are
just default constructed, so I created a wrapper class.

A new version is attached.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 4814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120830/e0d937a4/attachment.obj>


More information about the llvm-commits mailing list