@@ -397,12 +397,14 @@ class SwiftBinaryModuleDependencyStorage
397397 ArrayRef<ScannerImportStatementInfo> moduleImports,
398398 ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
399399 ArrayRef<LinkLibrary> linkLibraries, StringRef headerImport,
400- bool isFramework, bool isStatic, StringRef moduleCacheKey)
400+ StringRef definingModuleInterface, bool isFramework, bool isStatic,
401+ StringRef moduleCacheKey)
401402 : ModuleDependencyInfoStorageBase(ModuleDependencyKind::SwiftBinary,
402403 moduleImports, optionalModuleImports,
403404 linkLibraries, moduleCacheKey),
404405 compiledModulePath (compiledModulePath), moduleDocPath(moduleDocPath),
405406 sourceInfoPath(sourceInfoPath), headerImport(headerImport),
407+ definingModuleInterfacePath(definingModuleInterface),
406408 isFramework(isFramework), isStatic(isStatic) {}
407409
408410 ModuleDependencyInfoStorageBase *clone () const override {
@@ -421,6 +423,10 @@ class SwiftBinaryModuleDependencyStorage
421423 // / The path of the .h dependency of this module.
422424 const std::string headerImport;
423425
426+ // / The path of the defining .swiftinterface that this
427+ // / binary .swiftmodule was built from, if one exists.
428+ const std::string definingModuleInterfacePath;
429+
424430 // / Source files on which the header inputs depend.
425431 std::vector<std::string> headerSourceFiles;
426432
@@ -433,6 +439,15 @@ class SwiftBinaryModuleDependencyStorage
433439 // / A flag that indicates this dependency is associated with a static archive
434440 const bool isStatic;
435441
442+ // / Return the path to the defining .swiftinterface of this module
443+ // / of one was determined. Otherwise, return the .swiftmodule path
444+ // / itself.
445+ std::string getDefiningModulePath () const {
446+ if (definingModuleInterfacePath.empty ())
447+ return compiledModulePath;
448+ return definingModuleInterfacePath;
449+ }
450+
436451 static bool classof (const ModuleDependencyInfoStorageBase *base) {
437452 return base->dependencyKind == ModuleDependencyKind::SwiftBinary;
438453 }
@@ -588,12 +603,13 @@ class ModuleDependencyInfo {
588603 ArrayRef<ScannerImportStatementInfo> moduleImports,
589604 ArrayRef<ScannerImportStatementInfo> optionalModuleImports,
590605 ArrayRef<LinkLibrary> linkLibraries, StringRef headerImport,
591- bool isFramework, bool isStatic, StringRef moduleCacheKey) {
606+ StringRef definingModuleInterface, bool isFramework,
607+ bool isStatic, StringRef moduleCacheKey) {
592608 return ModuleDependencyInfo (
593609 std::make_unique<SwiftBinaryModuleDependencyStorage>(
594610 compiledModulePath, moduleDocPath, sourceInfoPath, moduleImports,
595- optionalModuleImports, linkLibraries, headerImport, isFramework,
596- isStatic, moduleCacheKey));
611+ optionalModuleImports, linkLibraries, headerImport,
612+ definingModuleInterface,isFramework, isStatic, moduleCacheKey));
597613 }
598614
599615 // / Describe the main Swift module.
0 commit comments