Rework getReexportedModules to optionally find all imported modules.

...instead of just those that are re-exported. This will be used for
autolinking (and probably few other places).

As part of this, we get two name changes:
  (1) Module::getReexportedModules -> getImportedModules
  (2) TranslationUnit::getImportedModules -> getImports

The latter doesn't just get modules-plus-access-paths; it also includes
whether or not the import is re-exported. Mainly, though, it just didn't
seem like a good idea to overload this name when the two functions aren't
really related.

No tests yet, will come with autolinking.

Swift SVN r7487
This commit is contained in:
Jordan Rose
2013-08-22 23:20:18 +00:00
parent 4980cb8217
commit f1bc7801f4
13 changed files with 83 additions and 58 deletions

View File

@@ -494,10 +494,11 @@ OperatorDecl *ModuleFile::lookupOperator(Identifier name, DeclKind fixity) {
return nullptr;
}
void ModuleFile::getReexportedModules(
SmallVectorImpl<Module::ImportedModule> &results) {
void ModuleFile::getImportedModules(
SmallVectorImpl<Module::ImportedModule> &results,
bool includePrivate) {
for (auto &dep : Dependencies) {
if (!dep.IsExported)
if (!includePrivate && !dep.IsExported)
continue;
assert(dep.isLoaded());
results.push_back(dep.Import);