[IDE] For the module interface, don't print submodule imports, unless they are submodules

of the module we are printing.

rdar://16530804

Swift SVN r16262
This commit is contained in:
Argyrios Kyrtzidis
2014-04-12 19:20:08 +00:00
parent 01c26070ec
commit 2da311cf1f
5 changed files with 42 additions and 6 deletions

View File

@@ -190,8 +190,24 @@ void swift::ide::printSubmoduleInterface(
if (Options.SkipUnavailable && D->getAttrs().isUnavailable())
continue;
auto ShouldPrintImport = [&](ImportDecl *ImportD) -> bool {
if (!InterestingClangModule)
return true;
auto ClangMod = ImportD->getClangModule();
if (!ClangMod)
return true;
if (!ClangMod->isSubModule())
return true;
if (ClangMod == InterestingClangModule)
return false;
// FIXME: const-ness on the clang API.
return ClangMod->isSubModuleOf(
const_cast<clang::Module*>(InterestingClangModule));
};
if (auto ID = dyn_cast<ImportDecl>(D)) {
ImportDecls.push_back(ID);
if (ShouldPrintImport(ID))
ImportDecls.push_back(ID);
continue;
}
if (auto CN = D->getClangNode()) {