@@ -367,13 +367,15 @@ class SwiftBinaryModuleDependencyStorage
367367 const std::string &sourceInfoPath,
368368 const std::vector<ScannerImportStatementInfo> &moduleImports,
369369 const std::vector<ScannerImportStatementInfo> &optionalModuleImports,
370- const std::string &headerImport, const bool isFramework,
370+ const std::string &headerImport,
371+ const std::string &definingModuleInterface, const bool isFramework,
371372 const std::string &moduleCacheKey)
372373 : ModuleDependencyInfoStorageBase(ModuleDependencyKind::SwiftBinary,
373374 moduleImports, optionalModuleImports,
374375 moduleCacheKey),
375376 compiledModulePath (compiledModulePath), moduleDocPath(moduleDocPath),
376377 sourceInfoPath(sourceInfoPath), headerImport(headerImport),
378+ definingModuleInterfacePath(definingModuleInterface),
377379 isFramework(isFramework) {}
378380
379381 ModuleDependencyInfoStorageBase *clone () const override {
@@ -392,6 +394,10 @@ class SwiftBinaryModuleDependencyStorage
392394 // / The path of the .h dependency of this module.
393395 const std::string headerImport;
394396
397+ // / The path of the defining .swiftinterface that this
398+ // / binary .swiftmodule was built from, if one exists.
399+ const std::string definingModuleInterfacePath;
400+
395401 // / Source files on which the header inputs depend.
396402 std::vector<std::string> headerSourceFiles;
397403
@@ -401,6 +407,15 @@ class SwiftBinaryModuleDependencyStorage
401407 // / A flag that indicates this dependency is a framework
402408 const bool isFramework;
403409
410+ // / Return the path to the defining .swiftinterface of this module
411+ // / of one was determined. Otherwise, return the .swiftmodule path
412+ // / itself.
413+ std::string getDefiningModulePath () const {
414+ if (definingModuleInterfacePath.empty ())
415+ return compiledModulePath;
416+ return definingModuleInterfacePath;
417+ }
418+
404419 static bool classof (const ModuleDependencyInfoStorageBase *base) {
405420 return base->dependencyKind == ModuleDependencyKind::SwiftBinary;
406421 }
@@ -560,12 +575,13 @@ class ModuleDependencyInfo {
560575 const std::vector<ScannerImportStatementInfo> &moduleImports,
561576 const std::vector<ScannerImportStatementInfo> &optionalModuleImports,
562577 const std::string &headerImport,
578+ const std::string &definingModuleInterface,
563579 bool isFramework, const std::string &moduleCacheKey) {
564580 return ModuleDependencyInfo (
565581 std::make_unique<SwiftBinaryModuleDependencyStorage>(
566582 compiledModulePath, moduleDocPath, sourceInfoPath,
567- moduleImports, optionalModuleImports,
568- headerImport , isFramework, moduleCacheKey));
583+ moduleImports, optionalModuleImports, headerImport,
584+ definingModuleInterface , isFramework, moduleCacheKey));
569585 }
570586
571587 // / Describe the main Swift module.
0 commit comments