[PATCH] D133988: [clang][deps] Make sure ScanInstance outlives collector

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 16:24:28 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added a reviewer: benlangmuir.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The `ScanInstance` is a local variable in `DependencyScanningAction::runInvocation()` that is referenced by `ModuleDepCollector`. Since D132405 <https://reviews.llvm.org/D132405>, `ModuleDepCollector` can escape the function and can outlive its `ScanInstance`. This patch fixes that by reference-counting `ScanInstance`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133988

Files:
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133988.460539.patch
Type: text/x-patch
Size: 12248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220915/88a76d84/attachment-0001.bin>


More information about the cfe-commits mailing list