[llvm-dev] help please: how to sort the contents of a "SymbolTableListTraits<GlobalVariable>"?

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 4 12:47:59 PDT 2016


On Thu, Aug 4, 2016 at 12:45 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:

>
> On Aug 4, 2016, at 11:52 AM, Daniel Berlin via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>
>
> On Thu, Aug 4, 2016 at 11:41 AM, Abe Skolnik via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> On 08/04/2016 01:33 PM, David Majnemer wrote:
>>
>> You should never be copying or moving around Values.
>>>
>>
>>
>>
>> Why not?  Is that because of this thing you also wrote in the same
>> message: "use lists are allocated before the object"?
>>
>>
> Among other things.
>
> They are simply not currently built to be relocated.
> attempts to do so will likely result in a huge mess.
>
> my strong recommendation here would be to stop trying to go down this
> path, and instead, if you want a sorted list, just put them in a separate
> container and sort them.
>
>
> The thing is that a “SymbolTable” is a “iplist” (it inherit from it) and,
> iplist has a “sort()” method, it is not clear why we can’t sort then?
>


Sorry, let me be 100% clear: I think it sucks, and you are 100% right.
I just meant "in terms of path of least resistance" for a user who may not
want to go diving into the depths of deep llvm implementation details just
to try to get something simple working.


>
> The fact that SymbolTable implementation is breaking one of its public
> method does not seem right to me.
>
> Also, in general, the design assuming any instance of a
> SymbolTable<GlobalVariabl> is owned by a Module and inspecting the “parent”
> using magic trick, seems … broken.
>

Yup.
But i think this is not the only iplist you will find this in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160804/2e022c09/attachment.html>


More information about the llvm-dev mailing list