mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -227,16 +227,19 @@ bool Deserializer::readGraph(GlobalModuleDependenciesCache &cache) {
|
||||
llvm::report_fatal_error(
|
||||
"Unexpected SWIFT_TEXTUAL_MODULE_DETAILS_NODE record");
|
||||
cache.configureForTriple(getTriple());
|
||||
unsigned interfaceFileID, compiledModuleCandidatesArrayID,
|
||||
unsigned outputPathFileID, interfaceFileID, compiledModuleCandidatesArrayID,
|
||||
buildCommandLineArrayID, extraPCMArgsArrayID, contextHashID,
|
||||
isFramework, bridgingHeaderFileID, sourceFilesArrayID,
|
||||
bridgingSourceFilesArrayID, bridgingModuleDependenciesArrayID;
|
||||
SwiftInterfaceModuleDetailsLayout::readRecord(
|
||||
Scratch, interfaceFileID, compiledModuleCandidatesArrayID,
|
||||
Scratch, outputPathFileID, interfaceFileID, compiledModuleCandidatesArrayID,
|
||||
buildCommandLineArrayID, extraPCMArgsArrayID, contextHashID,
|
||||
isFramework, bridgingHeaderFileID, sourceFilesArrayID,
|
||||
bridgingSourceFilesArrayID, bridgingModuleDependenciesArrayID);
|
||||
|
||||
auto outputModulePath = getIdentifier(outputPathFileID);
|
||||
if (!outputModulePath)
|
||||
llvm::report_fatal_error("Bad .swiftmodule output path");
|
||||
Optional<std::string> optionalSwiftInterfaceFile;
|
||||
if (interfaceFileID != 0) {
|
||||
auto swiftInterfaceFile = getIdentifier(interfaceFileID);
|
||||
@@ -267,6 +270,7 @@ bool Deserializer::readGraph(GlobalModuleDependenciesCache &cache) {
|
||||
|
||||
// Form the dependencies storage object
|
||||
auto moduleDep = ModuleDependencies::forSwiftInterfaceModule(
|
||||
outputModulePath.getValue(),
|
||||
optionalSwiftInterfaceFile.getValue(), *compiledModuleCandidates,
|
||||
buildCommandRefs, extraPCMRefs, *contextHash, isFramework);
|
||||
|
||||
@@ -782,6 +786,8 @@ void Serializer::writeModuleInfo(ModuleDependencyID moduleID,
|
||||
assert(triple.hasValue() && "Expected triple for serializing MODULE_NODE");
|
||||
auto swiftTextDeps = dependencyInfo.getAsSwiftInterfaceModule();
|
||||
assert(swiftTextDeps);
|
||||
unsigned outputModulePathFileId =
|
||||
getIdentifier(swiftTextDeps->moduleOutputPath);
|
||||
unsigned swiftInterfaceFileId =
|
||||
getIdentifier(swiftTextDeps->swiftInterfaceFile);
|
||||
unsigned bridgingHeaderFileId =
|
||||
@@ -791,6 +797,7 @@ void Serializer::writeModuleInfo(ModuleDependencyID moduleID,
|
||||
: 0;
|
||||
SwiftInterfaceModuleDetailsLayout::emitRecord(
|
||||
Out, ScratchRecord, AbbrCodes[SwiftInterfaceModuleDetailsLayout::Code],
|
||||
outputModulePathFileId,
|
||||
swiftInterfaceFileId,
|
||||
getArray(moduleID, ModuleIdentifierArrayKind::CompiledModuleCandidates),
|
||||
getArray(moduleID, ModuleIdentifierArrayKind::BuildCommandLine),
|
||||
@@ -981,6 +988,7 @@ void Serializer::collectStringsAndArrays(
|
||||
case swift::ModuleDependenciesKind::SwiftInterface: {
|
||||
auto swiftTextDeps = dependencyInfo.getAsSwiftInterfaceModule();
|
||||
assert(swiftTextDeps);
|
||||
addIdentifier(swiftTextDeps->moduleOutputPath);
|
||||
addIdentifier(swiftTextDeps->swiftInterfaceFile);
|
||||
addArray(moduleID,
|
||||
ModuleIdentifierArrayKind::CompiledModuleCandidates,
|
||||
|
||||
Reference in New Issue
Block a user