mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
DependenciesScanner: include compiled module candidates for textual module interface in JSON output
Instead of replacing an interface file with its up-to-date compile module, the dep-scanner should report potentially up-to-date module candidates either adjacent to the interface file or in the prebuilt module cache. swift-driver should later pass down these candidates to -compile-module-from-interface invocation and the front-end job will check if one of the candidates is ready to use. The front-end job then either emits a forwarding module to an up-to-date candidate or a binary module.
This commit is contained in:
@@ -1015,9 +1015,9 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
std::string
|
||||
ModuleInterfaceLoader::getUpToDateCompiledModuleForInterface(StringRef moduleName,
|
||||
StringRef interfacePath) {
|
||||
std::vector<std::string>
|
||||
ModuleInterfaceLoader::getCompiledModuleCandidatesForInterface(StringRef moduleName,
|
||||
StringRef interfacePath) {
|
||||
// Derive .swiftmodule path from the .swiftinterface path.
|
||||
auto newExt = file_types::getExtension(file_types::TY_SwiftModuleFile);
|
||||
llvm::SmallString<32> modulePath = interfacePath;
|
||||
@@ -1030,9 +1030,14 @@ ModuleInterfaceLoader::getUpToDateCompiledModuleForInterface(StringRef moduleNam
|
||||
llvm::is_contained(PreferInterfaceForModules, moduleName) ?
|
||||
ModuleLoadingMode::PreferInterface : LoadMode);
|
||||
SmallVector<FileDependency, 16> allDeps;
|
||||
std::string usableModulePath;
|
||||
Impl.discoverUpToDateCompiledModuleForInterface(allDeps, usableModulePath);
|
||||
return usableModulePath;
|
||||
std::vector<std::string> results;
|
||||
auto pair = Impl.getCompiledModuleCandidates();
|
||||
// Add compiled module candidates only when they are non-empty.
|
||||
if (!pair.first.empty())
|
||||
results.push_back(pair.first);
|
||||
if (!pair.second.empty())
|
||||
results.push_back(pair.second);
|
||||
return results;
|
||||
}
|
||||
|
||||
bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
|
||||
|
||||
Reference in New Issue
Block a user