diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-03 01:15:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-03 01:15:29 +0000 |
commit | c5e0f9b44782204437de21594c1748b1405d90bc (patch) | |
tree | 53f95616cc1d1dd40634838e4d0ae14bdf1fa3c7 | |
parent | f6137e4d15cb6bbd10547267babfc699c1945873 (diff) |
Module files representing actual modules don't need to know the set of modules they import, since that information isn't actually used. Drop it from the AST file
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145738 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 15db7050e9..b6198184cc 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -3335,25 +3335,26 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, I != E; ++I) WriteDeclContextVisibleUpdate(*I); - // Write the submodules that were imported, if any. - RecordData ImportedModules; - for (ASTContext::import_iterator I = Context.local_import_begin(), - IEnd = Context.local_import_end(); - I != IEnd; ++I) { - assert(SubmoduleIDs.find(I->getImportedModule()) != SubmoduleIDs.end()); - ImportedModules.push_back(SubmoduleIDs[I->getImportedModule()]); - } - if (!ImportedModules.empty()) { - // Sort module IDs. - llvm::array_pod_sort(ImportedModules.begin(), ImportedModules.end()); - - // Unique module IDs. - ImportedModules.erase(std::unique(ImportedModules.begin(), - ImportedModules.end()), - ImportedModules.end()); - - Stream.EmitRecord(IMPORTED_MODULES, ImportedModules); - ImportedModules.clear(); + if (!WritingModule) { + // Write the submodules that were imported, if any. + RecordData ImportedModules; + for (ASTContext::import_iterator I = Context.local_import_begin(), + IEnd = Context.local_import_end(); + I != IEnd; ++I) { + assert(SubmoduleIDs.find(I->getImportedModule()) != SubmoduleIDs.end()); + ImportedModules.push_back(SubmoduleIDs[I->getImportedModule()]); + } + if (!ImportedModules.empty()) { + // Sort module IDs. + llvm::array_pod_sort(ImportedModules.begin(), ImportedModules.end()); + + // Unique module IDs. + ImportedModules.erase(std::unique(ImportedModules.begin(), + ImportedModules.end()), + ImportedModules.end()); + + Stream.EmitRecord(IMPORTED_MODULES, ImportedModules); + } } WriteDeclUpdatesBlocks(); |