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

Abe Skolnik via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 4 12:34:45 PDT 2016


David Majnemer wrote:

   You should never be copying or moving around Values.

Abe wrote:
   Why not?  Is that because of this thing you also wrote in the same
   message: "use lists are allocated before the object"?


Daniel Berlin wrote:
   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,


Abe: I tried. :-(


[Daniel again]

   and instead, if you want a sorted list,
   just put them in a separate container and sort them.


Yup.  I tried that.  It went "boom". :-(

Maybe the essence what I did wrong when I tried it earlier was that the objects were 
effectively on the stack.  However, if/when using a typical implementation of either 
"std::list" or "std::vector", only the container metadata should be on the stack [when the 
container is a local], with the containees on the heap, no?


Regards,

Abe




More information about the llvm-dev mailing list