mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanner] Refactor ModuleDependencies to represent binary-only Swift modules explicitly
This matches the behavior of the current client (`swift-driver`) and reduces ambiguity in how the nodes in the graph are to be treated. Swift dependencies with a textual interface, for example, must be built into a binary module by clients. Swift dependencies without a textual interface, with only a binary module, are to be used directly, without any up-to-date checks. Note, this is distinct from Swift dependencies that have a textual interface, for which we also detect potential pre-build binary module candidates. Those are still reported in the `details` field of textual Swift dependencies as `prebuiltModuleCandidates`.
This commit is contained in:
@@ -166,10 +166,13 @@ Optional<ModuleDependencies> SerializedModuleLoaderBase::getModuleDependencies(
|
||||
InterfaceSubContextDelegate &delegate) {
|
||||
// Check whether we've cached this result.
|
||||
if (auto found = cache.findDependencies(
|
||||
moduleName, ModuleDependenciesKind::Swift))
|
||||
moduleName, ModuleDependenciesKind::SwiftTextual))
|
||||
return found;
|
||||
if (auto found =
|
||||
cache.findDependencies(moduleName, ModuleDependenciesKind::SwiftPlaceholder))
|
||||
if (auto found = cache.findDependencies(
|
||||
moduleName, ModuleDependenciesKind::SwiftBinary))
|
||||
return found;
|
||||
if (auto found = cache.findDependencies(
|
||||
moduleName, ModuleDependenciesKind::SwiftPlaceholder))
|
||||
return found;
|
||||
|
||||
auto moduleId = Ctx.getIdentifier(moduleName);
|
||||
@@ -191,8 +194,7 @@ Optional<ModuleDependencies> SerializedModuleLoaderBase::getModuleDependencies(
|
||||
for (auto &scanner : scanners) {
|
||||
if (scanner->canImportModule({moduleId, SourceLoc()})) {
|
||||
// Record the dependencies.
|
||||
cache.recordDependencies(moduleName, *(scanner->dependencies),
|
||||
scanner->dependencyKind);
|
||||
cache.recordDependencies(moduleName, *(scanner->dependencies));
|
||||
return std::move(scanner->dependencies);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user