[Dependency Scanning] Emit a note if a dependency cycle is between the source target and another Swift module with the same name

The note will point the user to where the "other" module with the same name is located and mention whether it is an SDK module. This is nice to have in various circumstances where developers attempt to define a module with the same name as a Swift module that already exists on their search paths, for example in the SDK.
This commit is contained in:
Artem Chikin
2025-07-01 13:09:23 -07:00
parent beb2b58d62
commit 0d3def55df
6 changed files with 134 additions and 25 deletions

View File

@@ -862,6 +862,12 @@ public:
/// Retrieve the dependencies for a Clang module.
const ClangModuleDependencyStorage *getAsClangModule() const;
/// Get the path to the module-defining file:
/// `SwiftInterface`: Textual Interface path
/// `SwiftBinary`: Binary module path
/// `Clang`: Module map path
std::string getModuleDefiningPath() const;
/// Add a dependency on the given module, if it was not already in the set.
void
addOptionalModuleImport(StringRef module, bool isExported,