DependenciesScanner: report user module version for textual Swift interfaces

This commit is contained in:
Xi Ge
2024-08-06 14:48:53 -07:00
parent 370bcec229
commit 98f4ad840a
14 changed files with 60 additions and 16 deletions

View File

@@ -255,14 +255,15 @@ bool ModuleDependenciesCacheDeserializer::readGraph(SwiftDependencyScanningServi
extraPCMArgsArrayID, contextHashID, isFramework, isStatic, bridgingHeaderFileID,
sourceFilesArrayID, bridgingSourceFilesArrayID,
bridgingModuleDependenciesArrayID, overlayDependencyIDArrayID,
CASFileSystemRootID, bridgingHeaderIncludeTreeID, moduleCacheKeyID;
CASFileSystemRootID, bridgingHeaderIncludeTreeID, moduleCacheKeyID,
userModuleVersionID;
SwiftInterfaceModuleDetailsLayout::readRecord(
Scratch, outputPathFileID, interfaceFileID,
compiledModuleCandidatesArrayID, buildCommandLineArrayID,
extraPCMArgsArrayID, contextHashID, isFramework, isStatic, bridgingHeaderFileID,
sourceFilesArrayID, bridgingSourceFilesArrayID,
bridgingModuleDependenciesArrayID, overlayDependencyIDArrayID,
CASFileSystemRootID, bridgingHeaderIncludeTreeID, moduleCacheKeyID);
CASFileSystemRootID, bridgingHeaderIncludeTreeID, moduleCacheKeyID, userModuleVersionID);
auto outputModulePath = getIdentifier(outputPathFileID);
if (!outputModulePath)
@@ -304,13 +305,17 @@ bool ModuleDependenciesCacheDeserializer::readGraph(SwiftDependencyScanningServi
auto moduleCacheKey = getIdentifier(moduleCacheKeyID);
if (!moduleCacheKeyID)
llvm::report_fatal_error("Bad moduleCacheKey");
auto userModuleVersion = getIdentifier(userModuleVersionID);
if (!userModuleVersion)
llvm::report_fatal_error("Bad userModuleVersion");
// TODO: LinkLibraries, MacroDependencies
// Form the dependencies storage object
auto moduleDep = ModuleDependencyInfo::forSwiftInterfaceModule(
outputModulePath.value(), optionalSwiftInterfaceFile.value(),
compiledCandidatesRefs, buildCommandRefs, {}, extraPCMRefs,
*contextHash, isFramework, isStatic, *rootFileSystemID, *moduleCacheKey);
*contextHash, isFramework, isStatic, *rootFileSystemID, *moduleCacheKey,
*userModuleVersion);
// Add imports of this module
for (const auto &moduleName : currentModuleImports)
@@ -1007,7 +1012,8 @@ void ModuleDependenciesCacheSerializer::writeModuleInfo(
getIdentifier(swiftTextDeps->textualModuleDetails.CASFileSystemRootID),
getIdentifier(swiftTextDeps->textualModuleDetails
.CASBridgingHeaderIncludeTreeRootID),
getIdentifier(swiftTextDeps->moduleCacheKey));
getIdentifier(swiftTextDeps->moduleCacheKey),
getIdentifier(swiftTextDeps->userModuleVersion));
break;
}
case swift::ModuleDependencyKind::SwiftSource: {