Do not build Swift interface files into binary modules when performing a canImport query.

We should hold off actually building the binary module file until it is imported.
`canImport` queries can happen, for example, during dependency scanning, when we do not wish to have the scanner tool execute any module builds.

Resolves rdar://82603098
This commit is contained in:
Artem Chikin
2021-09-01 16:06:21 -07:00
parent 1907a820ea
commit 1b7d55582d
9 changed files with 50 additions and 22 deletions

View File

@@ -32,7 +32,7 @@ std::error_code ModuleDependencyScanner::findModuleFilesInDirectory(
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
bool IsFramework) {
bool skipBuildingInterface, bool IsFramework) {
using namespace llvm::sys;
auto &fs = *Ctx.SourceMgr.getFileSystem();
@@ -77,7 +77,7 @@ std::error_code PlaceholderSwiftModuleScanner::findModuleFilesInDirectory(
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
bool IsFramework) {
bool skipBuildingInterface, bool IsFramework) {
StringRef moduleName = ModuleID.Item.str();
auto it = PlaceholderDependencyModuleMap.find(moduleName);
// If no placeholder module stub path is given matches the name, return with an