[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:
Artem Chikin
2020-10-08 14:18:00 -07:00
parent 6651f6e55d
commit f9d6c6a619
11 changed files with 358 additions and 191 deletions

View File

@@ -394,8 +394,13 @@ llvm::ErrorOr<ModuleDependencies> SerializedModuleLoaderBase::scanModuleFile(
nullptr,
isFramework, loadedModuleFile);
const std::string moduleDocPath;
const std::string sourceInfoPath;
// Map the set of dependencies over to the "module dependencies".
auto dependencies = ModuleDependencies::forSwiftModule(modulePath.str(), isFramework);
auto dependencies = ModuleDependencies::forSwiftBinaryModule(modulePath.str(),
moduleDocPath,
sourceInfoPath,
isFramework);
llvm::StringSet<> addedModuleNames;
for (const auto &dependency : loadedModuleFile->getDependencies()) {
// FIXME: Record header dependency?