Begin refactoring for mixed file kinds within a single module.

The goal of this series of commits is to allow the main module to consist
of both source files and AST files, where the AST files represent files
that were already built and don't need to be rebuilt, or of Swift source
files and imported Clang headers that share a module (because they are in
the same target).

Currently modules are divided into different kinds, and that defines how
decls are looked up, how imports are managed, etc. In order to achieve the
goal above, that polymorphism should be pushed down to the individual units
within a module, so that instead of TranslationUnit, BuiltinModule,
SerializedModule, and ClangModule, we have SourceFile, BuiltinUnit,
SerializedFile, and ClangUnit. (Better names welcome.) At that point we can
hopefully collapse TranslationUnit into Module and make Module non-polymorphic.

This commit makes SourceFile the subclass of an abstract FileUnit, and
makes TranslationUnit hold an array of FileUnits instead of SourceFiles.
To demonstrate that this is actually working, the Builtin module has also
been converted to FileUnit: it is now a TranslationUnit containing a single
BuiltinUnit.

Swift SVN r10830
This commit is contained in:
Jordan Rose
2013-12-05 01:51:03 +00:00
parent 17b21b8b1a
commit eede5ec4f9
28 changed files with 397 additions and 235 deletions

View File

@@ -200,7 +200,7 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
return module;
}
void SerializedModuleLoader::lookupValue(Module *module,
void SerializedModuleLoader::lookupValue(const Module *module,
Module::AccessPathTy accessPath,
Identifier name, NLKind lookupKind,
SmallVectorImpl<ValueDecl*> &results) {