Add the notion of "re-exported" modules, and use that where it makes sense.

Rather than automatically re-exporting or not re-exporting every import in
a TranslationUnit, we'll eventually want to control which imports are local
(most of them) and which imports are shared with eventual module loaders.
It's probably not worth implementing this for TranslationUnit, but
LoadedModule can certainly do something here.

Currently, a LoadedModule is even more permissive than a TranslationUnit:
all imports are re-exported. We can lock down on this once we have a
re-export syntax.

Swift SVN r6523
This commit is contained in:
Jordan Rose
2013-07-23 23:10:17 +00:00
parent 110d644297
commit 3087e8d5ea
10 changed files with 76 additions and 55 deletions

View File

@@ -26,20 +26,6 @@
using namespace swift;
namespace {
class SerializedModule : public LoadedModule {
public:
ModuleFile *File;
SerializedModule(ASTContext &ctx, SerializedModuleLoader &owner,
Identifier name, Component *comp, ModuleFile *file)
: LoadedModule(DeclContextKind::SerializedModule, name, comp, ctx, owner),
File(file) {}
static bool classof(const DeclContext *DC) {
return DC->getContextKind() == DeclContextKind::SerializedModule;
}
};
typedef std::pair<Identifier, SourceLoc> AccessPathElem;
}
@@ -248,8 +234,8 @@ OperatorDecl *SerializedModuleLoader::lookupOperator(Module *module,
}
void SerializedModuleLoader::getReexportedModules(
Module *module,
SmallVectorImpl<swift::Module *> &exports) {
const Module *module,
SmallVectorImpl<Module::ImportedModule> &exports) {
ModuleFile *moduleFile = cast<SerializedModule>(module)->File;
if (!moduleFile)