mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Handle binary module dependencies' Swift overlay dependencies
The code, previously, only properly handled such dependencies being a distinct category for Swift source and Swift textual dependency infos. Swift binary module dependencies must handle this similarly and this change adds the missing support for them. Recent refactor of the scanner also means that now Swift binary dependencies with Swift overlay dependencies may crash the scanner, and this change resolves this as well. Resolves rdar://117088840
This commit is contained in:
@@ -474,11 +474,12 @@ bool ModuleDependenciesCacheDeserializer::readGraph(SwiftDependencyScanningServi
|
||||
"Unexpected SWIFT_BINARY_MODULE_DETAILS_NODE record");
|
||||
cache.configureForContextHash(getContextHash());
|
||||
unsigned compiledModulePathID, moduleDocPathID, moduleSourceInfoPathID,
|
||||
headerImportsArrayID, isFramework, moduleCacheKeyID;
|
||||
overlayDependencyIDArrayID, headerImportsArrayID, isFramework,
|
||||
moduleCacheKeyID;
|
||||
SwiftBinaryModuleDetailsLayout::readRecord(
|
||||
Scratch, compiledModulePathID, moduleDocPathID,
|
||||
moduleSourceInfoPathID, headerImportsArrayID, isFramework,
|
||||
moduleCacheKeyID);
|
||||
moduleSourceInfoPathID, overlayDependencyIDArrayID,
|
||||
headerImportsArrayID, isFramework, moduleCacheKeyID);
|
||||
|
||||
auto compiledModulePath = getIdentifier(compiledModulePathID);
|
||||
if (!compiledModulePath)
|
||||
@@ -503,6 +504,12 @@ bool ModuleDependenciesCacheDeserializer::readGraph(SwiftDependencyScanningServi
|
||||
*currentModuleImports, *currentOptionalModuleImports,
|
||||
*headerImports, isFramework, *moduleCacheKey);
|
||||
|
||||
// Add Swift overlay dependencies
|
||||
auto overlayModuleDependencyIDs = getModuleDependencyIDArray(overlayDependencyIDArrayID);
|
||||
if (!overlayModuleDependencyIDs.has_value())
|
||||
llvm::report_fatal_error("Bad overlay dependencies: no qualified dependencies");
|
||||
moduleDep.setOverlayDependencies(overlayModuleDependencyIDs.value());
|
||||
|
||||
cache.recordDependency(currentModuleName, std::move(moduleDep),
|
||||
getContextHash());
|
||||
hasCurrentModule = false;
|
||||
@@ -999,6 +1006,7 @@ void ModuleDependenciesCacheSerializer::writeModuleInfo(
|
||||
getIdentifier(swiftBinDeps->compiledModulePath),
|
||||
getIdentifier(swiftBinDeps->moduleDocPath),
|
||||
getIdentifier(swiftBinDeps->sourceInfoPath),
|
||||
getArrayID(moduleID, ModuleIdentifierArrayKind::SwiftOverlayDependencyIDs),
|
||||
getArrayID(moduleID, ModuleIdentifierArrayKind::DependencyHeaders),
|
||||
swiftBinDeps->isFramework,
|
||||
getIdentifier(swiftBinDeps->moduleCacheKey));
|
||||
@@ -1165,7 +1173,7 @@ void ModuleDependenciesCacheSerializer::collectStringsAndArrays(
|
||||
swiftTextDeps->textualModuleDetails.bridgingModuleDependencies);
|
||||
addDependencyIDArray(
|
||||
moduleID, ModuleIdentifierArrayKind::SwiftOverlayDependencyIDs,
|
||||
swiftTextDeps->textualModuleDetails.swiftOverlayDependencies);
|
||||
swiftTextDeps->swiftOverlayDependencies);
|
||||
addIdentifier(swiftTextDeps->textualModuleDetails.CASFileSystemRootID);
|
||||
addIdentifier(swiftTextDeps->textualModuleDetails
|
||||
.CASBridgingHeaderIncludeTreeRootID);
|
||||
@@ -1181,6 +1189,9 @@ void ModuleDependenciesCacheSerializer::collectStringsAndArrays(
|
||||
addIdentifier(swiftBinDeps->moduleCacheKey);
|
||||
addStringArray(moduleID, ModuleIdentifierArrayKind::DependencyHeaders,
|
||||
swiftBinDeps->preCompiledBridgingHeaderPaths);
|
||||
addDependencyIDArray(
|
||||
moduleID, ModuleIdentifierArrayKind::SwiftOverlayDependencyIDs,
|
||||
swiftBinDeps->swiftOverlayDependencies);
|
||||
break;
|
||||
}
|
||||
case swift::ModuleDependencyKind::SwiftPlaceholder: {
|
||||
@@ -1210,7 +1221,7 @@ void ModuleDependenciesCacheSerializer::collectStringsAndArrays(
|
||||
swiftSourceDeps->textualModuleDetails.bridgingModuleDependencies);
|
||||
addDependencyIDArray(
|
||||
moduleID, ModuleIdentifierArrayKind::SwiftOverlayDependencyIDs,
|
||||
swiftSourceDeps->textualModuleDetails.swiftOverlayDependencies);
|
||||
swiftSourceDeps->swiftOverlayDependencies);
|
||||
addStringArray(
|
||||
moduleID, ModuleIdentifierArrayKind::BuildCommandLine,
|
||||
swiftSourceDeps->textualModuleDetails.buildCommandLine);
|
||||
|
||||
Reference in New Issue
Block a user