[Dependency Scanning] Produce canonical output path for Swift binary modules.

Instead of relying on the client (driver) to perform its own computation of the matching output path.
This commit is contained in:
Artem Chikin
2022-11-11 16:12:53 -08:00
parent 5e208ff30e
commit 729ad402df
14 changed files with 65 additions and 37 deletions

View File

@@ -118,12 +118,15 @@ ErrorOr<ModuleDependencies> ModuleDependencyScanner::scanInterfaceFile(
std::string InPath = moduleInterfacePath.str();
auto compiledCandidates = getCompiledCandidates(Ctx, realModuleName.str(),
InPath);
Result = ModuleDependencies::forSwiftInterfaceModule(InPath,
compiledCandidates,
Args,
PCMArgs,
Hash,
isFramework);
SmallString<128> outputPathBase(moduleCachePath);
llvm::sys::path::append(
outputPathBase,
moduleName.str() + "-" + Hash + "." +
file_types::getExtension(file_types::TY_SwiftModuleFile));
Result = ModuleDependencies::forSwiftInterfaceModule(
outputPathBase.str().str(), InPath, compiledCandidates, Args, PCMArgs,
Hash, isFramework);
// Open the interface file.
auto &fs = *Ctx.SourceMgr.getFileSystem();
auto interfaceBuf = fs.getBufferForFile(moduleInterfacePath);