[Caching][NFC] Restructure CASOption in swift. NFC

Clean up how CASOptions are kept and passed inside swift to make the
code more readable. Also avoid a copy of CAS configuration in
ClangImporter.
This commit is contained in:
Steven Wu
2024-02-08 16:51:14 -08:00
parent 71640be109
commit 3986937e03
35 changed files with 293 additions and 217 deletions

View File

@@ -419,18 +419,19 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
// in the .swiftinterface file itself. Instead, creation of that
// job should incorporate those flags.
if (FEOpts.ExplicitInterfaceBuild &&
!(FEOpts.isTypeCheckAction() && !FEOpts.EnableCaching))
!(FEOpts.isTypeCheckAction() &&
!Invocation.getCASOptions().EnableCaching))
return ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
Instance, Invocation.getClangModuleCachePath(),
FEOpts.BackupModuleInterfaceDir, PrebuiltCachePath, ABIPath, InputPath,
Invocation.getOutputFilename(),
/* shouldSerializeDeps */ true,
Invocation.getSearchPathOptions().CandidateCompiledModules);
else
return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
Instance.getSourceMgr(), Instance.getDiags(),
Invocation.getSearchPathOptions(), Invocation.getLangOptions(),
Invocation.getClangImporterOptions(),
Invocation.getClangImporterOptions(), Invocation.getCASOptions(),
Invocation.getClangModuleCachePath(), PrebuiltCachePath,
FEOpts.BackupModuleInterfaceDir, Invocation.getModuleName(), InputPath,
Invocation.getOutputFilename(), ABIPath,
@@ -1455,7 +1456,7 @@ static bool performAction(CompilerInstance &Instance,
/// false and will not replay any output.
static bool tryReplayCompilerResults(CompilerInstance &Instance) {
if (!Instance.supportCaching() ||
Instance.getInvocation().getFrontendOptions().CacheSkipReplay)
Instance.getInvocation().getCASOptions().CacheSkipReplay)
return false;
assert(Instance.getCompilerBaseKey() &&
@@ -1471,7 +1472,7 @@ static bool tryReplayCompilerResults(CompilerInstance &Instance) {
Instance.getObjectStore(), Instance.getActionCache(),
*Instance.getCompilerBaseKey(), Instance.getDiags(),
Instance.getInvocation().getFrontendOptions().InputsAndOutputs, *CDP,
Instance.getInvocation().getFrontendOptions().EnableCachingRemarks);
Instance.getInvocation().getCASOptions().EnableCachingRemarks);
// If we didn't replay successfully, re-start capture.
if (!replayed)