@@ -381,19 +381,17 @@ class DependencyScanningAction {
381381 DependencyScanningService &Service, StringRef WorkingDirectory,
382382 DependencyConsumer &Consumer, DependencyActionController &Controller,
383383 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS,
384- bool DisableFree, std::optional<StringRef> ModuleName = std::nullopt )
384+ std::optional<StringRef> ModuleName = std::nullopt )
385385 : Service(Service), WorkingDirectory(WorkingDirectory),
386386 Consumer (Consumer), Controller(Controller), DepFS(std::move(DepFS)),
387- DisableFree(DisableFree), ModuleName(ModuleName) {}
387+ ModuleName(ModuleName) {}
388388
389389 bool runInvocation (std::shared_ptr<CompilerInvocation> Invocation,
390390 IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
391391 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
392392 DiagnosticConsumer *DiagConsumer) {
393393 // Make a deep copy of the original Clang invocation.
394394 CompilerInvocation OriginalInvocation (*Invocation);
395- // Restore the value of DisableFree, which may be modified by Tooling.
396- OriginalInvocation.getFrontendOpts ().DisableFree = DisableFree;
397395 if (any (Service.getOptimizeArgs () & ScanningOptimizations::Macros))
398396 canonicalizeDefines (OriginalInvocation.getPreprocessorOpts ());
399397
@@ -430,6 +428,7 @@ class DependencyScanningAction {
430428 ScanInstance.getHeaderSearchOpts ().BuildSessionTimestamp =
431429 Service.getBuildSessionTimestamp ();
432430
431+ ScanInstance.getFrontendOpts ().DisableFree = false ;
433432 ScanInstance.getFrontendOpts ().GenerateGlobalModuleIndex = false ;
434433 ScanInstance.getFrontendOpts ().UseGlobalModuleIndex = false ;
435434 // This will prevent us compiling individual modules asynchronously since
@@ -580,7 +579,6 @@ class DependencyScanningAction {
580579 DependencyConsumer &Consumer;
581580 DependencyActionController &Controller;
582581 llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> DepFS;
583- bool DisableFree;
584582 std::optional<StringRef> ModuleName;
585583 std::optional<CompilerInstance> ScanInstanceStorage;
586584 std::shared_ptr<ModuleDepCollector> MDC;
@@ -745,12 +743,8 @@ bool DependencyScanningWorker::scanDependencies(
745743 auto Diags = CompilerInstance::createDiagnostics (*FS, *DiagOpts, &DC,
746744 /* ShouldOwnClient=*/ false );
747745
748- // DisableFree is modified by Tooling for running
749- // in-process; preserve the original value, which is
750- // always true for a driver invocation.
751- bool DisableFree = true ;
752746 DependencyScanningAction Action (Service, WorkingDirectory, Consumer,
753- Controller, DepFS, DisableFree, ModuleName);
747+ Controller, DepFS, ModuleName);
754748
755749 bool Success = false ;
756750 if (CommandLine[1 ] == " -cc1" ) {
0 commit comments