Don't parse function bodies in imported TUs.

...unless the functions are declared [transparent], or if we're in an
immediate mode (in which case we won't get a separate chance to link
against the imported TUs).

This is an optimization that will matter more when we start dealing with
Xcode projects with many cross-file dependencies, especially if we have
some kind of implicit import of the other source files in the project.

In the future, we may want to parse more function bodies for the purpose
of inlining, not just the transparent ones, but we weren't taking
advantage of that now, so it's not a regression. (We're still not taking
advantage of it even for [transparent] functions.)

Swift SVN r7698
This commit is contained in:
Jordan Rose
2013-08-28 22:53:28 +00:00
parent f82f001518
commit fa3dd42c54
12 changed files with 98 additions and 21 deletions

View File

@@ -41,7 +41,8 @@ bool swift::CompilerInstance::setup(const CompilerInvocation &Invok) {
// Give the context the list of search paths to use for modules.
Context->ImportSearchPaths = Invocation.getImportSearchPaths();
Context->addModuleLoader(SourceLoader::create(*Context));
Context->addModuleLoader(SourceLoader::create(*Context,
!Invocation.isImmediate()));
Context->addModuleLoader(SerializedModuleLoader::create(*Context));
// If the user has specified an SDK, wire up the Clang module importer