[llvm-commits] [PATCH 01/20] Add DenseMapInfo for std::string

Eli Friedman eli.friedman at gmail.com
Wed Jul 20 08:19:08 PDT 2011


On Tue, Jul 19, 2011 at 3:56 PM, David A. Greene <greened at obbligato.org> wrote:
> Eli Friedman <eli.friedman at gmail.com> writes:
>
>> On Tue, Jul 19, 2011 at 2:11 PM, David A. Greene <greened at obbligato.org> wrote:
>>> Eli Friedman <eli.friedman at gmail.com> writes:
>>>
>>>> On Tue, Jul 19, 2011 at 1:11 PM, David Greene <dag at cray.com> wrote:
>>>> This is unsafe in general; TableGen might never see the string
>>>> "<<<EMPTY KEY>>>", but you can't assume arbitrary code using this
>>>> header will not see it.
>>>
>>> True, but it's highly unlikely.  Do you have a better alternative?  I
>>> certainly would like to do this the Right Way.
>>
>> Use std::map?  It's not like performance matters here.
>
> Well, Chris suggested using DenseMap with std::string and this is all I
> could come up with.  Originally I used a FoldingSet but several people
> objected due to performance concerns.  So I'm a bit stuck.  :(

If you must, make a custom TableGenStringKey class (my name not really
suggested) containing an std::string, and implement DenseMapInfo on
that.

-Eli




More information about the llvm-commits mailing list