diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-27 18:24:41 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-27 18:24:41 +0000 |
commit | d692af71226d2fb537d86c670af96114ddd485c3 (patch) | |
tree | 911bdd7619417c34757323f4b31000c0529d6039 /lib/Frontend/PCHWriter.cpp | |
parent | b698688fe116ef6fc4711798af7292537f4d0d12 (diff) |
Update the list of lexical decls in the TU for chained PCHs. This makes -ast-print show the decls from the dependent PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 0ade10f7f8..96c64169cf 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -2354,15 +2354,23 @@ void PCHWriter::WritePCHChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, // The TU was loaded before we managed to register ourselves as a listener. // Thus we need to add it manually. DeclIDs[TU] = 1; - Record.clear(); + llvm::SmallVector<pch::DeclID, 64> NewGlobalDecls; for (DeclContext::decl_iterator I = TU->noload_decls_begin(), E = TU->noload_decls_end(); I != E; ++I) { - if ((*I)->getPCHLevel() == 0) { - AddDeclRef(*I, Record); - } + if ((*I)->getPCHLevel() == 0) + NewGlobalDecls.push_back(GetDeclRef(*I)); } // We also need to write a lexical updates block for the TU. + llvm::BitCodeAbbrev *Abv = new llvm::BitCodeAbbrev(); + Abv->Add(llvm::BitCodeAbbrevOp(pch::TU_UPDATE_LEXICAL)); + Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob)); + unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(Abv); + Record.clear(); + Record.push_back(pch::TU_UPDATE_LEXICAL); + Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record, + reinterpret_cast<const char*>(NewGlobalDecls.data()), + NewGlobalDecls.size() * sizeof(pch::DeclID)); Stream.EnterSubblock(pch::DECLTYPES_BLOCK_ID, 3); WriteDeclsBlockAbbrevs(); |