SourceKit: avoid self-imports in generated Swift interfaces

Generated Swift interfaces for modules with overlays, like Foundation or Dispatch, currently contain `import Foundation`/`import Dispatch` statements.

These imports are redundant, and this change removes them.
This commit is contained in:
Egor Zhdan
2021-01-14 14:27:41 +03:00
parent c5e7a36277
commit bce1f9377b
7 changed files with 1552 additions and 1596 deletions

View File

@@ -609,6 +609,9 @@ void swift::ide::printModuleInterface(
auto ShouldPrintImport = [&](ImportDecl *ImportD) -> bool {
if (!TargetClangMod)
return true;
if (ImportD->getModule() == TargetMod)
return false;
auto ImportedMod = ImportD->getClangModule();
if (!ImportedMod)
return true;