Introduce "SourceFile" within a TranslationUnit.

Right now this is just an extra layer of indirection for the decls,
operators, and imports in a TU, but it's the first step towards compiling
multiple source files at once without pretending they're all in a single
file. This is important for the "implicit visibility" feature, where
declarations from other source files in the same module are accessible
from the file currently being compiled.

Swift SVN r9072
This commit is contained in:
Jordan Rose
2013-10-09 18:38:15 +00:00
parent 37bb48afb0
commit 597640a5d2
18 changed files with 168 additions and 105 deletions

View File

@@ -386,7 +386,7 @@ void Serializer::writeInputFiles(const TranslationUnit *TU,
SourceFile.emit(ScratchRecord, path);
}
for (auto import : TU->getImports()) {
for (auto import : TU->MainSourceFile->getImports()) {
if (import.first.second == TU->Ctx.TheBuiltinModule)
continue;
@@ -1924,7 +1924,7 @@ void Serializer::writeTranslationUnit(const TranslationUnit *TU, const SILModule
writeSILFunctions(M);
DeclTable topLevelDecls, extensionDecls, operatorDecls;
for (auto D : TU->Decls) {
for (auto D : TU->MainSourceFile->Decls) {
if (isa<ImportDecl>(D))
continue;
else if (auto VD = dyn_cast<ValueDecl>(D)) {