diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-12-03 00:59:55 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-12-03 00:59:55 +0000 |
| commit | f6137e4d15cb6bbd10547267babfc699c1945873 (patch) | |
| tree | 1b5aabc0a8300dcfbdfd0e10e39554ba2e605f31 /lib/Serialization/ASTReader.cpp | |
| parent | f394078fde147dcf27e9b6a7965517388d64dcb6 (diff) | |
| download | clang-f6137e4d15cb6bbd10547267babfc699c1945873.tar.gz clang-f6137e4d15cb6bbd10547267babfc699c1945873.tar.bz2 clang-f6137e4d15cb6bbd10547267babfc699c1945873.tar.xz | |
Implement support for precompiled headers, preambles, and serialized
"main" files that import modules. When loading any of these kinds of
AST files, we make the modules that were imported visible into the
translation unit that loaded the PCH file or preamble.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
| -rw-r--r-- | lib/Serialization/ASTReader.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 22e34d62af..c7b6b512a5 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -2385,6 +2385,20 @@ ASTReader::ReadASTBlock(ModuleFile &F) { for (unsigned I = 0, N = Record.size(); I != N; ++I) KnownNamespaces.push_back(getGlobalDeclID(F, Record[I])); break; + + case IMPORTED_MODULES: { + if (F.Kind != MK_Module) { + // If we aren't loading a module (which has its own exports), make + // all of the imported modules visible. + // FIXME: Deal with macros-only imports. + for (unsigned I = 0, N = Record.size(); I != N; ++I) { + if (unsigned GlobalID = getGlobalSubmoduleID(F, Record[I])) + ImportedModules.push_back(GlobalID); + } + } + break; + + } } } Error("premature end of bitstream in AST file"); @@ -2835,6 +2849,13 @@ void ASTReader::InitializeContext() { Context.setcudaConfigureCallDecl( cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0]))); } + + // Re-export any modules that were imported by a non-module AST file. + for (unsigned I = 0, N = ImportedModules.size(); I != N; ++I) { + if (Module *Imported = getSubmodule(ImportedModules[I])) + makeModuleVisible(Imported, Module::AllVisible); + } + ImportedModules.clear(); } void ASTReader::finalizeForWriting() { |
