Fznamznon added a comment.

> Should OutputStream be made into a shared_ptr so we can clarify the memory 
> ownership instead of leaving it as a raw pointer? That should also address 
> the use-after-free.

Well, I was thinking about that and wasn't sure about it either. 
https://reviews.llvm.org/D129456 added initialization of `OutputStream` from 
the outside. When last shared_ptr is destroyed, it destroys undelying object as 
well. In case underlying object came from the outside in a form of raw pointer, 
we may end up accidentally deleting it when DumpModuleInfoAction is destroyed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146412

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

Reply via email to