Revert "[Caching][NFC] Using llvm::cas::CASConfiguration"

This reverts commit 4f059033bb. The change
is actually not NFC since previously, there is a cache in the
CompilerInvocation that prevents the same CAS from the same CASOptions
from being initialized multiple times, which was relied upon when
running inside sub invocation. When switching to a non-caching simple
CASOption types, it causes every single sub instance will create its own
CAS, and it can consume too many file descriptors and causing errors
during dependency scanning.

rdar://164903080
This commit is contained in:
Steven Wu
2025-11-17 11:38:16 -08:00
parent c337446464
commit 8e68fab034
9 changed files with 23 additions and 32 deletions

View File

@@ -637,9 +637,9 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
if (!Instance.getInvocation().getCASOptions().EnableCaching)
return false;
if (CASConfig) {
if (CASOpts) {
// If CASOption matches, the service is initialized already.
if (*CASConfig == Instance.getInvocation().getCASOptions().Config)
if (*CASOpts == Instance.getInvocation().getCASOptions().CASOpts)
return false;
// CASOption mismatch, return error.
@@ -648,18 +648,13 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
}
// Setup CAS.
CASConfig = Instance.getInvocation().getCASOptions().Config;
clang::CASOptions CASOpts;
CASOpts.CASPath = CASConfig->CASPath;
CASOpts.PluginPath = CASConfig->PluginPath;
CASOpts.PluginOptions = CASConfig->PluginOptions;
CASOpts = Instance.getInvocation().getCASOptions().CASOpts;
ClangScanningService.emplace(
clang::tooling::dependencies::ScanningMode::DependencyDirectivesScan,
clang::tooling::dependencies::ScanningOutputFormat::FullIncludeTree,
CASOpts, Instance.getSharedCASInstance(),
Instance.getSharedCacheInstance(),
Instance.getInvocation().getCASOptions().CASOpts,
Instance.getSharedCASInstance(), Instance.getSharedCacheInstance(),
/*CachingOnDiskFileSystem=*/nullptr,
// The current working directory optimization (off by default)
// should not impact CAS. We set the optization to all to be