clayborg added a comment.

> Storing raw pointers in DieToTypePtr may cause use-after-frees to occur, 
> since there are no guarantees that the shared pointers that owns the 
> underlying pointer to the type are kept around as long as the map. Change the 
> map to store a shared pointer instead.

This isn't true. SymbolFile has a m_type_list that is used to store all shared 
pointers to any types that are created. Since SymbolFileDWARF is an instance of 
SymbolFile, it is safe to store "Type *" anywhere inside this class because as 
along as the SymbolFileDWARF is around, so will the SymbolFile that owns all of 
the types. If there are any places where someone is creating a type and _not_ 
storing it in the SymbolFile::m_type_list, then this is the bug and that should 
be fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141318/new/

https://reviews.llvm.org/D141318

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to