benlangmuir added a comment.

I find this a bit hard to understand as far as object lifetime is concerned: 
you're storing the `ScanInstance` in `TranslationUnitDeps`, but that's a layer 
above the actual consumer interface, which means every consumer needs to 
understand how this lifetime is managed or it will have dangling references by 
default.  You also seem to have ScanInstance stored twice -- once explicitly 
and once in the graph.

What do you think of an alternate design where `ModuleDeps` has 
`shared_ptr<ModuleDepCollector> MDC` and `ModuleDepCollector` has 
`shared_ptr<CompilerInstance>`?  That way we don't need to explicitly expose 
the scan instance to the consumer, it comes with the `ModuleDeps`, which then 
keeps all the necessary memory alive?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158469

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

Reply via email to