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

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 09:44:29 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e637fcb2550: [clang][deps] Make sure ScanInstance outlives collector (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133988

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -174,7 +174,8 @@
     Scanned = true;
 
     // Create a compiler instance to handle the actual work.
-    CompilerInstance ScanInstance(std::move(PCHContainerOps));
+    ScanInstanceStorage.emplace(std::move(PCHContainerOps));
+    CompilerInstance &ScanInstance = *ScanInstanceStorage;
     ScanInstance.setInvocation(std::move(Invocation));
 
     // Create the compiler's actual diagnostics engine.
@@ -304,7 +305,8 @@
   bool OptimizeArgs;
   bool EagerLoadModules;
   bool DisableFree;
-  llvm::Optional<StringRef> ModuleName;
+  Optional<StringRef> ModuleName;
+  Optional<CompilerInstance> ScanInstanceStorage;
   std::shared_ptr<ModuleDepCollector> MDC;
   std::vector<std::string> LastCC1Arguments;
   bool Scanned = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133988.460806.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220916/d81c335b/attachment-0001.bin>


More information about the cfe-commits mailing list