jansvoboda11 added a comment. In D158469#4611923 <https://reviews.llvm.org/D158469#4611923>, @benlangmuir wrote:
> 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. Agreed, I'm not happy about the lifetime complexity here. > 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? I tried that approach, but found it way too easy to keep `ModuleDeps` around, which keep scanning instances alive, and use tons of memory. 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