[PATCH] D25419: Use unique_ptr in LLVMContextImpl's constant maps.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 09:22:42 PDT 2016


jlebar added inline comments.


================
Comment at: llvm/lib/IR/LLVMContextImpl.cpp:106
   for (auto &CDSConstant : CDSConstants)
     delete CDSConstant.second;
   CDSConstants.clear();
----------------
jlebar wrote:
> timshen wrote:
> > Do you want to change this one as well?
> Sure, but this one is complicated enough I'll put it in its own patch.
Actually, this one is very complicated, because we're walking a linked list where the head is now a unique_ptr but the other elements are raw pointers, and we assume we can assign into any of them using generic code...

I'll save it for another day.  I'd call DeleteContainerSeconds, but that doesn't work because the destructors of the map's value types are protected...  :)


https://reviews.llvm.org/D25419





More information about the cfe-commits mailing list