[PATCH] D158469: [clang][deps] Compute command lines and file deps on-demand

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 15:42:17 PDT 2023


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



More information about the cfe-commits mailing list