[Dependency Scanning] Refactor dependency scanner to return an in-memory format as a result

This commit refactors ScanDependencies.cpp to split the functionality into two functional groups:
- Scan execution code that performs the mechanics of the scan and produces an in-memory result
- Dependency scanner entry-points used when the scanning action is invoked as a `swift-frontend` execution mode
This commit also adds the aforementioned in-memory dependency scanning result in `FullDependencies.h`, modeled after the InterModuleDependencyGraph representation in swift-driver
This commit is contained in:
Artem Chikin
2020-11-20 10:00:01 -08:00
parent dad14358fb
commit 082fc48b25
7 changed files with 649 additions and 237 deletions

View File

@@ -1137,11 +1137,14 @@ static bool performScanDependencies(CompilerInstance &Instance) {
ModuleDependenciesCache SingleUseCache;
if (batchScanInput.empty()) {
if (Instance.getInvocation().getFrontendOptions().ImportPrescan)
return dependencies::prescanMainModuleDependencies(Instance);
return dependencies::prescanDependencies(Instance);
else
return dependencies::scanDependencies(Instance);
} else {
return dependencies::batchScanDependencies(Instance, batchScanInput);
if (Instance.getInvocation().getFrontendOptions().ImportPrescan)
return dependencies::batchPrescanDependencies(Instance, batchScanInput);
else
return dependencies::batchScanDependencies(Instance, batchScanInput);
}
}